Class: DatadogAPIClient::V2::ScorecardsAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ScorecardsAPI.



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

def api_client
  @api_client
end

Instance Method Details

#create_scorecard_campaign(body, opts = {}) ⇒ Object

Create a new campaign.



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

def create_scorecard_campaign(body, opts = {})
  data, _status_code, _headers = create_scorecard_campaign_with_http_info(body, opts)
  data
end

#create_scorecard_campaign_with_http_info(body, opts = {}) ⇒ Array<(CampaignResponse, Integer, Hash)>

Create a new campaign.

Creates a new scorecard campaign.

Parameters:

  • body (CreateCampaignRequest)

    Campaign data.

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

    the optional parameters

Returns:

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

    CampaignResponse data, response status code and response headers



41
42
43
44
45
46
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
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 41

def create_scorecard_campaign_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.create_scorecard_campaign ...'
  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 ScorecardsAPI.create_scorecard_campaign"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/campaigns'

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

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

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

#create_scorecard_outcomes_batch(body, opts = {}) ⇒ Object

Create outcomes batch.



96
97
98
99
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 96

def create_scorecard_outcomes_batch(body, opts = {})
  data, _status_code, _headers = create_scorecard_outcomes_batch_with_http_info(body, opts)
  data
end

#create_scorecard_outcomes_batch_with_http_info(body, opts = {}) ⇒ Array<(OutcomesBatchResponse, Integer, Hash)>

Deprecated.

This API is deprecated.

Create outcomes batch.

Sets multiple service-rule outcomes in a single batched request.

Parameters:

  • body (OutcomesBatchRequest)

    Set of scorecard outcomes.

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

    the optional parameters

Returns:

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

    OutcomesBatchResponse data, response status code and response headers



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 110

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.create_scorecard_outcomes_batch ...'
  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 ScorecardsAPI.create_scorecard_outcomes_batch"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/outcomes/batch'

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

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

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

#create_scorecard_rule(body, opts = {}) ⇒ Object

Create a new rule.



172
173
174
175
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 172

def create_scorecard_rule(body, opts = {})
  data, _status_code, _headers = create_scorecard_rule_with_http_info(body, opts)
  data
end

#create_scorecard_rule_with_http_info(body, opts = {}) ⇒ Array<(CreateRuleResponse, Integer, Hash)>

Create a new rule.

Creates a new rule.

Parameters:

  • body (CreateRuleRequest)

    Rule attributes.

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

    the optional parameters

Returns:

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

    CreateRuleResponse data, response status code and response headers



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 184

def create_scorecard_rule_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.create_scorecard_rule ...'
  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 ScorecardsAPI.create_scorecard_rule"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/rules'

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

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

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

#delete_scorecard_campaign(campaign_id, opts = {}) ⇒ Object

Delete a campaign.



239
240
241
242
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 239

def delete_scorecard_campaign(campaign_id, opts = {})
  delete_scorecard_campaign_with_http_info(campaign_id, opts)
  nil
end

#delete_scorecard_campaign_with_http_info(campaign_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a campaign.

Deletes a single campaign by ID or key.

Parameters:

  • campaign_id (String)

    Campaign ID or key.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 251

def delete_scorecard_campaign_with_http_info(campaign_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.delete_scorecard_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ScorecardsAPI.delete_scorecard_campaign"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/campaigns/{campaign_id}'.sub('{campaign_id}', CGI.escape(campaign_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(['*/*'])

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#delete_scorecard_rule(rule_id, opts = {}) ⇒ Object

Delete a rule.



304
305
306
307
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 304

def delete_scorecard_rule(rule_id, opts = {})
  delete_scorecard_rule_with_http_info(rule_id, opts)
  nil
end

#delete_scorecard_rule_with_http_info(rule_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a rule.

Deletes a single rule.

Parameters:

  • rule_id (String)

    The ID of the rule.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 316

def delete_scorecard_rule_with_http_info(rule_id, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.delete_scorecard_rule ...'
  end
  # verify the required parameter 'rule_id' is set
  if @api_client.config.client_side_validation && rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'rule_id' when calling ScorecardsAPI.delete_scorecard_rule"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_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(['*/*'])

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#get_scorecard_campaign(campaign_id, opts = {}) ⇒ Object

Get a campaign.



369
370
371
372
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 369

def get_scorecard_campaign(campaign_id, opts = {})
  data, _status_code, _headers = get_scorecard_campaign_with_http_info(campaign_id, opts)
  data
end

#get_scorecard_campaign_with_http_info(campaign_id, opts = {}) ⇒ Array<(CampaignResponse, Integer, Hash)>

Get a campaign.

Fetches a single campaign by ID or key.

Parameters:

  • campaign_id (String)

    Campaign ID or key.

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

    the optional parameters

Options Hash (opts):

  • :include (String)

    Include related data (for example, scores).

  • :include_meta (Boolean)

    Include metadata (entity and rule counts).

Returns:

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

    CampaignResponse data, response status code and response headers



383
384
385
386
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
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 383

def get_scorecard_campaign_with_http_info(campaign_id, opts = {})

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

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

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

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

#list_scorecard_campaigns(opts = {}) ⇒ Object

List all campaigns.



438
439
440
441
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 438

def list_scorecard_campaigns(opts = {})
  data, _status_code, _headers = list_scorecard_campaigns_with_http_info(opts)
  data
end

#list_scorecard_campaigns_with_http_info(opts = {}) ⇒ Array<(ListCampaignsResponse, Integer, Hash)>

List all campaigns.

Fetches all scorecard campaigns.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_limit (Integer)

    Maximum number of campaigns to return.

  • :page_offset (Integer)

    Offset for pagination.

  • :filter_campaign_name (String)

    Filter campaigns by name (full-text search).

  • :filter_campaign_status (String)

    Filter campaigns by status.

  • :filter_campaign_owner (String)

    Filter campaigns by owner UUID.

Returns:

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

    ListCampaignsResponse data, response status code and response headers



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
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
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 454

def list_scorecard_campaigns_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecard_campaigns ...'
  end
  # resource path
  local_var_path = '/api/v2/scorecard/campaigns'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'filter[campaign][name]'] = opts[:'filter_campaign_name'] if !opts[:'filter_campaign_name'].nil?
  query_params[:'filter[campaign][status]'] = opts[:'filter_campaign_status'] if !opts[:'filter_campaign_status'].nil?
  query_params[:'filter[campaign][owner]'] = opts[:'filter_campaign_owner'] if !opts[:'filter_campaign_owner'].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] || 'ListCampaignsResponse'

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

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

#list_scorecard_outcomes(opts = {}) ⇒ Object

List all rule outcomes.



508
509
510
511
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 508

def list_scorecard_outcomes(opts = {})
  data, _status_code, _headers = list_scorecard_outcomes_with_http_info(opts)
  data
end

#list_scorecard_outcomes_with_http_info(opts = {}) ⇒ Array<(OutcomesResponse, Integer, Hash)>

List all rule outcomes.

Fetches all rule outcomes.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_size (Integer)

    Size for a given page. The maximum allowed value is 100.

  • :page_offset (Integer)

    Specific offset to use as the beginning of the returned page.

  • :include (String)

    Include related rule details in the response.

  • :fields_outcome (String)

    Return only specified values in the outcome attributes.

  • :fields_rule (String)

    Return only specified values in the included rule details.

  • :filter_outcome_service_name (String)

    Filter outcomes on a specific service name.

  • :filter_outcome_state (String)

    Filter outcomes by a specific state.

  • :filter_rule_enabled (Boolean)

    Filter outcomes based on whether a rule is enabled or disabled.

  • :filter_rule_id (String)

    Filter outcomes based on rule ID.

  • :filter_rule_name (String)

    Filter outcomes based on rule name.

Returns:

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

    OutcomesResponse data, response status code and response headers



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 529

def list_scorecard_outcomes_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecard_outcomes ...'
  end
  # resource path
  local_var_path = '/api/v2/scorecard/outcomes'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
  query_params[:'fields[outcome]'] = opts[:'fields_outcome'] if !opts[:'fields_outcome'].nil?
  query_params[:'fields[rule]'] = opts[:'fields_rule'] if !opts[:'fields_rule'].nil?
  query_params[:'filter[outcome][service_name]'] = opts[:'filter_outcome_service_name'] if !opts[:'filter_outcome_service_name'].nil?
  query_params[:'filter[outcome][state]'] = opts[:'filter_outcome_state'] if !opts[:'filter_outcome_state'].nil?
  query_params[:'filter[rule][enabled]'] = opts[:'filter_rule_enabled'] if !opts[:'filter_rule_enabled'].nil?
  query_params[:'filter[rule][id]'] = opts[:'filter_rule_id'] if !opts[:'filter_rule_id'].nil?
  query_params[:'filter[rule][name]'] = opts[:'filter_rule_name'] if !opts[:'filter_rule_name'].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] || 'OutcomesResponse'

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

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

#list_scorecard_outcomes_with_pagination(opts = {}) {|OutcomesResponseDataItem| ... } ⇒ Object

List all rule outcomes.

Provide a paginated version of #list_scorecard_outcomes, returning all items.

To use it you need to use a block: list_scorecard_outcomes_with_pagination { |item| p item }

Yields:



592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 592

def list_scorecard_outcomes_with_pagination(opts = {})
    api_version = "V2"
    page_size = @api_client.get_attribute_from_path(opts, "page_size", 10)
    @api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size)
    while true do
        response = list_scorecard_outcomes(opts)
        @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) }
        if @api_client.get_attribute_from_path(response, "data").length < page_size
          break
        end
        @api_client.set_attribute_from_path(api_version, opts, "page_offset", Integer, @api_client.get_attribute_from_path(opts, "page_offset", 0) + page_size)
    end
end

#list_scorecard_rules(opts = {}) ⇒ Object

List all rules.



609
610
611
612
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 609

def list_scorecard_rules(opts = {})
  data, _status_code, _headers = list_scorecard_rules_with_http_info(opts)
  data
end

#list_scorecard_rules_with_http_info(opts = {}) ⇒ Array<(ListRulesResponse, Integer, Hash)>

List all rules.

Fetch all rules.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_size (Integer)

    Size for a given page. The maximum allowed value is 100.

  • :page_offset (Integer)

    Specific offset to use as the beginning of the returned page.

  • :include (String)

    Include related scorecard details in the response.

  • :filter_rule_id (String)

    Filter the rules on a rule ID.

  • :filter_rule_enabled (Boolean)

    Filter for enabled rules only.

  • :filter_rule_custom (Boolean)

    Filter for custom rules only.

  • :filter_rule_name (String)

    Filter rules on the rule name.

  • :filter_rule_description (String)

    Filter rules on the rule description.

  • :fields_rule (String)

    Return only specific fields in the response for rule attributes.

  • :fields_scorecard (String)

    Return only specific fields in the included response for scorecard attributes.

Returns:

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

    ListRulesResponse data, response status code and response headers



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 630

def list_scorecard_rules_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecard_rules ...'
  end
  # resource path
  local_var_path = '/api/v2/scorecard/rules'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
  query_params[:'filter[rule][id]'] = opts[:'filter_rule_id'] if !opts[:'filter_rule_id'].nil?
  query_params[:'filter[rule][enabled]'] = opts[:'filter_rule_enabled'] if !opts[:'filter_rule_enabled'].nil?
  query_params[:'filter[rule][custom]'] = opts[:'filter_rule_custom'] if !opts[:'filter_rule_custom'].nil?
  query_params[:'filter[rule][name]'] = opts[:'filter_rule_name'] if !opts[:'filter_rule_name'].nil?
  query_params[:'filter[rule][description]'] = opts[:'filter_rule_description'] if !opts[:'filter_rule_description'].nil?
  query_params[:'fields[rule]'] = opts[:'fields_rule'] if !opts[:'fields_rule'].nil?
  query_params[:'fields[scorecard]'] = opts[:'fields_scorecard'] if !opts[:'fields_scorecard'].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] || 'ListRulesResponse'

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

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

#list_scorecard_rules_with_pagination(opts = {}) {|ListRulesResponseDataItem| ... } ⇒ Object

List all rules.

Provide a paginated version of #list_scorecard_rules, returning all items.

To use it you need to use a block: list_scorecard_rules_with_pagination { |item| p item }

Yields:



693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 693

def list_scorecard_rules_with_pagination(opts = {})
    api_version = "V2"
    page_size = @api_client.get_attribute_from_path(opts, "page_size", 10)
    @api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size)
    while true do
        response = list_scorecard_rules(opts)
        @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) }
        if @api_client.get_attribute_from_path(response, "data").length < page_size
          break
        end
        @api_client.set_attribute_from_path(api_version, opts, "page_offset", Integer, @api_client.get_attribute_from_path(opts, "page_offset", 0) + page_size)
    end
end

#list_scorecards(opts = {}) ⇒ Object

List all scorecards.



710
711
712
713
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 710

def list_scorecards(opts = {})
  data, _status_code, _headers = list_scorecards_with_http_info(opts)
  data
end

#list_scorecards_with_http_info(opts = {}) ⇒ Array<(ListScorecardsResponse, Integer, Hash)>

List all scorecards.

Fetches all scorecards.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_offset (Integer)

    Offset for pagination.

  • :page_size (Integer)

    Maximum number of scorecards to return.

  • :filter_scorecard_id (String)

    Filter by scorecard ID.

  • :filter_scorecard_name (String)

    Filter by scorecard name (partial match).

  • :filter_scorecard_description (String)

    Filter by scorecard description (partial match).

Returns:

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

    ListScorecardsResponse data, response status code and response headers



726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 726

def list_scorecards_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecards ...'
  end
  # resource path
  local_var_path = '/api/v2/scorecard/scorecards'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'filter[scorecard][id]'] = opts[:'filter_scorecard_id'] if !opts[:'filter_scorecard_id'].nil?
  query_params[:'filter[scorecard][name]'] = opts[:'filter_scorecard_name'] if !opts[:'filter_scorecard_name'].nil?
  query_params[:'filter[scorecard][description]'] = opts[:'filter_scorecard_description'] if !opts[:'filter_scorecard_description'].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] || 'ListScorecardsResponse'

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

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

#update_scorecard_campaign(campaign_id, body, opts = {}) ⇒ Object

Update a campaign.



780
781
782
783
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 780

def update_scorecard_campaign(campaign_id, body, opts = {})
  data, _status_code, _headers = update_scorecard_campaign_with_http_info(campaign_id, body, opts)
  data
end

#update_scorecard_campaign_with_http_info(campaign_id, body, opts = {}) ⇒ Array<(CampaignResponse, Integer, Hash)>

Update a campaign.

Updates an existing campaign.

Parameters:

  • campaign_id (String)

    Campaign ID or key.

  • body (UpdateCampaignRequest)

    Campaign data.

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

    the optional parameters

Returns:

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

    CampaignResponse data, response status code and response headers



793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 793

def update_scorecard_campaign_with_http_info(campaign_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.update_scorecard_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ScorecardsAPI.update_scorecard_campaign"
  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 ScorecardsAPI.update_scorecard_campaign"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/campaigns/{campaign_id}'.sub('{campaign_id}', CGI.escape(campaign_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'])
  # 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] || 'CampaignResponse'

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

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

#update_scorecard_outcomes(body, opts = {}) ⇒ Object

Update Scorecard outcomes.



852
853
854
855
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 852

def update_scorecard_outcomes(body, opts = {})
  update_scorecard_outcomes_with_http_info(body, opts)
  nil
end

#update_scorecard_outcomes_with_http_info(body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update Scorecard outcomes.

Updates multiple scorecard rule outcomes in a single batched request.

Parameters:

Returns:

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

    nil, response status code and response headers



864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 864

def update_scorecard_outcomes_with_http_info(body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.update_scorecard_outcomes ...'
  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 ScorecardsAPI.update_scorecard_outcomes"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/outcomes'

  # 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(['*/*'])
  # 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]

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

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

#update_scorecard_rule(rule_id, body, opts = {}) ⇒ Object

Update an existing scorecard rule.



919
920
921
922
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 919

def update_scorecard_rule(rule_id, body, opts = {})
  data, _status_code, _headers = update_scorecard_rule_with_http_info(rule_id, body, opts)
  data
end

#update_scorecard_rule_with_http_info(rule_id, body, opts = {}) ⇒ Array<(UpdateRuleResponse, Integer, Hash)>

Update an existing scorecard rule.

Updates an existing rule.

Parameters:

  • rule_id (String)

    The ID of the rule.

  • body (UpdateRuleRequest)

    Rule attributes.

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

    the optional parameters

Returns:

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

    UpdateRuleResponse data, response status code and response headers



932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
# File 'lib/datadog_api_client/v2/api/scorecards_api.rb', line 932

def update_scorecard_rule_with_http_info(rule_id, body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScorecardsAPI.update_scorecard_rule ...'
  end
  # verify the required parameter 'rule_id' is set
  if @api_client.config.client_side_validation && rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'rule_id' when calling ScorecardsAPI.update_scorecard_rule"
  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 ScorecardsAPI.update_scorecard_rule"
  end
  # resource path
  local_var_path = '/api/v2/scorecard/rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_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'])
  # 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] || 'UpdateRuleResponse'

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

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