Class: DatadogAPIClient::V2::FormsAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of FormsAPI.



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

def api_client
  @api_client
end

Instance Method Details

#clone_form(form_id, body, opts = {}) ⇒ Object

Clone a form.



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

def clone_form(form_id, body, opts = {})
  data, _status_code, _headers = clone_form_with_http_info(form_id, body, opts)
  data
end

#clone_form_with_http_info(form_id, body, opts = {}) ⇒ Array<(FormResponse, Integer, Hash)>

Clone a form.

Clone an existing form. The clone is created in draft mode using the source form's latest version.

Parameters:

  • form_id (UUID)

    The ID of the form to clone.

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

    the optional parameters

Returns:

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

    FormResponse data, response status code and response headers



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
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 42

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.clone_form ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.clone_form"
  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 FormsAPI.clone_form"
  end
  # resource path
  local_var_path = '/api/v2/forms/{form_id}/clone'.sub('{form_id}', CGI.escape(form_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] || 'FormResponse'

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

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

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

Create and publish a form.



107
108
109
110
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 107

def create_and_publish_form(body, opts = {})
  data, _status_code, _headers = create_and_publish_form_with_http_info(body, opts)
  data
end

#create_and_publish_form_with_http_info(body, opts = {}) ⇒ Array<(FormResponse, Integer, Hash)>

Create and publish a form.

Creates a new form and immediately publishes its initial version. This also creates a new datastore for form responses and links it to the form.

Parameters:

Returns:

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

    FormResponse data, response status code and response headers



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
168
169
170
171
172
173
174
175
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 119

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.create_and_publish_form ...'
  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 FormsAPI.create_and_publish_form"
  end
  # resource path
  local_var_path = '/api/v2/forms/create_and_publish'

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

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

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

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

Create a form.



180
181
182
183
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 180

def create_form(body, opts = {})
  data, _status_code, _headers = create_form_with_http_info(body, opts)
  data
end

#create_form_with_http_info(body, opts = {}) ⇒ Array<(FormResponse, Integer, Hash)>

Create a form.

Create a new form. The form is created in draft mode and must be published before it can be used. This also creates a new datastore for form responses and links it to the form.

Parameters:

Returns:

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

    FormResponse data, response status code and response headers



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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 192

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

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

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

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

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

#delete_form(form_id, opts = {}) ⇒ Object

Delete a form.



253
254
255
256
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 253

def delete_form(form_id, opts = {})
  data, _status_code, _headers = delete_form_with_http_info(form_id, opts)
  data
end

#delete_form_with_http_info(form_id, opts = {}) ⇒ Array<(DeleteFormResponse, Integer, Hash)>

Delete a form.

Delete a form by its ID. This will also try to delete the associated datastore.

Parameters:

  • form_id (UUID)

    The ID of the form.

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

    the optional parameters

Returns:

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

    DeleteFormResponse data, response status code and response headers



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
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 265

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.delete_form ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.delete_form"
  end
  # resource path
  local_var_path = '/api/v2/forms/{form_id}'.sub('{form_id}', CGI.escape(form_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] || 'DeleteFormResponse'

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

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

#get_form(form_id, opts = {}) ⇒ Object

Get a form.



324
325
326
327
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 324

def get_form(form_id, opts = {})
  data, _status_code, _headers = get_form_with_http_info(form_id, opts)
  data
end

#get_form_with_http_info(form_id, opts = {}) ⇒ Array<(FormResponse, Integer, Hash)>

Get a form.

Get a form definition by its ID.

Parameters:

  • form_id (UUID)

    The ID of the form.

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    The version of the form to retrieve. Use 'latest' for the most recent draft, 'published' for the last published version, or a specific version number.

Returns:

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

    FormResponse data, response status code and response headers



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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 337

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

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'version'] = opts[:'version'] if !opts[:'version'].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] || 'FormResponse'

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

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

#list_forms(opts = {}) ⇒ Object

List forms.



397
398
399
400
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 397

def list_forms(opts = {})
  data, _status_code, _headers = list_forms_with_http_info(opts)
  data
end

#list_forms_with_http_info(opts = {}) ⇒ Array<(FormsResponse, Integer, Hash)>

List forms.

Get all forms for the authenticated user's organization.

Parameters:

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

    the optional parameters

Returns:

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

    FormsResponse data, response status code and response headers



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/forms_api.rb', line 408

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.list_forms ...'
  end
  # resource path
  local_var_path = '/api/v2/forms'

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

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

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

#publish_form(form_id, body, opts = {}) ⇒ Object

Publish a form version.



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

def publish_form(form_id, body, opts = {})
  data, _status_code, _headers = publish_form_with_http_info(form_id, body, opts)
  data
end

#publish_form_with_http_info(form_id, body, opts = {}) ⇒ Array<(FormPublicationResponse, Integer, Hash)>

Publish a form version.

Publish a specific version of a form, making it available for submissions.

Parameters:

  • form_id (UUID)

    The ID of the form.

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

    the optional parameters

Returns:

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

    FormPublicationResponse data, response status code and response headers



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
530
531
532
533
534
535
536
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 476

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.publish_form ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.publish_form"
  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 FormsAPI.publish_form"
  end
  # resource path
  local_var_path = '/api/v2/forms/{form_id}/publish'.sub('{form_id}', CGI.escape(form_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] || 'FormPublicationResponse'

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

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

#update_form(form_id, body, opts = {}) ⇒ Object

Update a form.



541
542
543
544
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 541

def update_form(form_id, body, opts = {})
  data, _status_code, _headers = update_form_with_http_info(form_id, body, opts)
  data
end

#update_form_with_http_info(form_id, body, opts = {}) ⇒ Array<(FormResponse, Integer, Hash)>

Update a form.

Update a form's properties such as its name, description, or datastore configuration.

Parameters:

  • form_id (UUID)

    The ID of the form.

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

    the optional parameters

Returns:

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

    FormResponse data, response status code and response headers



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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 554

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.update_form ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.update_form"
  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 FormsAPI.update_form"
  end
  # resource path
  local_var_path = '/api/v2/forms/{form_id}'.sub('{form_id}', CGI.escape(form_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] || 'FormResponse'

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

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

#upsert_and_publish_form_version(form_id, body, opts = {}) ⇒ Object

Upsert and publish a form version.



619
620
621
622
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 619

def upsert_and_publish_form_version(form_id, body, opts = {})
  data, _status_code, _headers = upsert_and_publish_form_version_with_http_info(form_id, body, opts)
  data
end

#upsert_and_publish_form_version_with_http_info(form_id, body, opts = {}) ⇒ Array<(FormResponse, Integer, Hash)>

Upsert and publish a form version.

Upsert the latest form version and publish it in a single atomic transaction.

Parameters:

Returns:

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

    FormResponse data, response status code and response headers



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
685
686
687
688
689
690
691
692
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 632

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.upsert_and_publish_form_version ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.upsert_and_publish_form_version"
  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 FormsAPI.upsert_and_publish_form_version"
  end
  # resource path
  local_var_path = '/api/v2/forms/{form_id}/versions/upsert_and_publish'.sub('{form_id}', CGI.escape(form_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] || 'FormResponse'

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

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

#upsert_form_version(form_id, body, opts = {}) ⇒ Object

Create or update a form version.



697
698
699
700
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 697

def upsert_form_version(form_id, body, opts = {})
  data, _status_code, _headers = upsert_form_version_with_http_info(form_id, body, opts)
  data
end

#upsert_form_version_with_http_info(form_id, body, opts = {}) ⇒ Array<(FormVersionResponse, Integer, Hash)>

Create or update a form version.

Create or update the latest draft version of a form. The upsert_params field controls optimistic concurrency behavior.

Parameters:

  • form_id (UUID)

    The ID of the form.

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

    the optional parameters

Returns:

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

    FormVersionResponse data, response status code and response headers



711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
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
# File 'lib/datadog_api_client/v2/api/forms_api.rb', line 711

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FormsAPI.upsert_form_version ...'
  end
  # verify the required parameter 'form_id' is set
  if @api_client.config.client_side_validation && form_id.nil?
    fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.upsert_form_version"
  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 FormsAPI.upsert_form_version"
  end
  # resource path
  local_var_path = '/api/v2/forms/{form_id}/versions'.sub('{form_id}', CGI.escape(form_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] || 'FormVersionResponse'

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

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