Class: InfluxDB2::API::TasksApi

Inherits:
Object
  • Object
show all
Defined in:
apis/lib/influxdb2/apis/generated/api/tasks_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TasksApi

Returns a new instance of TasksApi.



18
19
20
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 18

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#delete_tasks_id(task_id, opts = {}) ⇒ nil

Delete a task Deletes the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. To disable a task instead of delete it, use [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task status to `inactive`.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

  • (nil)


27
28
29
30
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 27

def delete_tasks_id(task_id, opts = {})
  delete_tasks_id_with_http_info(task_id, opts)
  nil
end

#delete_tasks_id_labels_id(task_id, label_id, opts = {}) ⇒ nil

Delete a label from a task Deletes a label from a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

  • (nil)


88
89
90
91
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 88

def delete_tasks_id_labels_id(task_id, label_id, opts = {})
  delete_tasks_id_labels_id_with_http_info(task_id, label_id, opts)
  nil
end

#delete_tasks_id_labels_id_with_http_info(task_id, label_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a label from a task Deletes a label from a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    nil, response status code and response headers



100
101
102
103
104
105
106
107
108
109
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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 100

def delete_tasks_id_labels_id_with_http_info(task_id, label_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.delete_tasks_id_labels_id"
  end
  # verify the required parameter 'label_id' is set
  if @api_client.config.client_side_validation && label_id.nil?
    fail ArgumentError, "Missing the required parameter 'label_id' when calling TasksApi.delete_tasks_id_labels_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/labels/{labelID}'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s)).sub('{' + 'labelID' + '}', CGI.escape(label_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

  # 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] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.delete_tasks_id_labels_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  return data, status_code, headers
end

#delete_tasks_id_members_id(user_id, task_id, opts = {}) ⇒ nil

Remove a member from a task *Deprecated*: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Removes a member from a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

  • (nil)


154
155
156
157
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 154

def delete_tasks_id_members_id(user_id, task_id, opts = {})
  delete_tasks_id_members_id_with_http_info(user_id, task_id, opts)
  nil
end

#delete_tasks_id_members_id_with_http_info(user_id, task_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove a member from a task *Deprecated*: Tasks don&#39;t use &#x60;owner&#x60; and &#x60;member&#x60; roles. Use [&#x60;/api/v2/authorizations&#x60;](#tag/Authorizations-(API-tokens)) to assign user permissions. Removes a member from a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    nil, response status code and response headers



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
202
203
204
205
206
207
208
209
210
211
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 166

def delete_tasks_id_members_id_with_http_info(user_id, task_id, opts = {})
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TasksApi.delete_tasks_id_members_id"
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.delete_tasks_id_members_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/members/{userID}'.sub('{' + 'userID' + '}', CGI.escape(user_id.to_s)).sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

  # 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] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.delete_tasks_id_members_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  return data, status_code, headers
end

#delete_tasks_id_owners_id(user_id, task_id, opts = {}) ⇒ nil

Remove an owner from a task *Deprecated*: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Removes an owner from a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

  • (nil)


220
221
222
223
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 220

def delete_tasks_id_owners_id(user_id, task_id, opts = {})
  delete_tasks_id_owners_id_with_http_info(user_id, task_id, opts)
  nil
end

#delete_tasks_id_owners_id_with_http_info(user_id, task_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove an owner from a task *Deprecated*: Tasks don&#39;t use &#x60;owner&#x60; and &#x60;member&#x60; roles. Use [&#x60;/api/v2/authorizations&#x60;](#tag/Authorizations-(API-tokens)) to assign user permissions. Removes an owner from a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    nil, response status code and response headers



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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 232

def delete_tasks_id_owners_id_with_http_info(user_id, task_id, opts = {})
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TasksApi.delete_tasks_id_owners_id"
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.delete_tasks_id_owners_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/owners/{userID}'.sub('{' + 'userID' + '}', CGI.escape(user_id.to_s)).sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

  # 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] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.delete_tasks_id_owners_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  return data, status_code, headers
end

#delete_tasks_id_runs_id(task_id, run_id, opts = {}) ⇒ nil

Cancel a running task Cancels a running [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to cancel a running task. #### InfluxDB Cloud - Doesn't support this operation.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

  • (nil)


286
287
288
289
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 286

def delete_tasks_id_runs_id(task_id, run_id, opts = {})
  delete_tasks_id_runs_id_with_http_info(task_id, run_id, opts)
  nil
end

#delete_tasks_id_runs_id_with_http_info(task_id, run_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Cancel a running task Cancels a running [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to cancel a running task. #### InfluxDB Cloud - Doesn&#39;t support this operation.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    nil, response status code and response headers



298
299
300
301
302
303
304
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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 298

def delete_tasks_id_runs_id_with_http_info(task_id, run_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.delete_tasks_id_runs_id"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling TasksApi.delete_tasks_id_runs_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/runs/{runID}'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s)).sub('{' + 'runID' + '}', CGI.escape(run_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

  # 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] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.delete_tasks_id_runs_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  return data, status_code, headers
end

#delete_tasks_id_with_http_info(task_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a task Deletes the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. To disable a task instead of delete it, use [&#x60;PATCH /api/v2/tasks/TASK_ID&#x60;](#operation/PatchTasksID) to set the task status to &#x60;inactive&#x60;.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    nil, response status code and response headers



38
39
40
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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 38

def delete_tasks_id_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.delete_tasks_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

  # 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] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.delete_tasks_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks(opts = {}) ⇒ Tasks

List tasks Lists [tasks](docs.influxdata.com/influxdb/latest/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. #### Related guide - [Process data with InfluxDB tasks](docs.influxdata.com/influxdb/latest/process-data/)

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



358
359
360
361
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 358

def get_tasks(opts = {})
  data, _status_code, _headers = get_tasks_with_http_info(opts)
  data
end

#get_tasks_id(task_id, opts = {}) ⇒ Task

Retrieve a task Retrieves the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



445
446
447
448
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 445

def get_tasks_id(task_id, opts = {})
  data, _status_code, _headers = get_tasks_id_with_http_info(task_id, opts)
  data
end

#get_tasks_id_labels(task_id, opts = {}) ⇒ LabelsResponse

List labels for a task Lists all labels for a task. Use this endpoint to list labels applied to a task. Labels are a way to add metadata to InfluxDB resources. You can use labels for grouping and filtering resources in the InfluxDB UI, `influx` CLI, and InfluxDB API.

Parameters:

  • task_id (String)

    A task ID. Specifies the task to retrieve labels for.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



505
506
507
508
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 505

def get_tasks_id_labels(task_id, opts = {})
  data, _status_code, _headers = get_tasks_id_labels_with_http_info(task_id, opts)
  data
end

#get_tasks_id_labels_with_http_info(task_id, opts = {}) ⇒ Array<(LabelsResponse, Integer, Hash)>

List labels for a task Lists all labels for a task. Use this endpoint to list labels applied to a task. Labels are a way to add metadata to InfluxDB resources. You can use labels for grouping and filtering resources in the InfluxDB UI, &#x60;influx&#x60; CLI, and InfluxDB API.

Parameters:

  • task_id (String)

    A task ID. Specifies the task to retrieve labels for.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    LabelsResponse data, response status code and response headers



516
517
518
519
520
521
522
523
524
525
526
527
528
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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 516

def get_tasks_id_labels_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_labels"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/labels'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_labels",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_logs(task_id, opts = {}) ⇒ Logs

List logs for a task Lists all log events for a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). When a task runs, InfluxDB creates a `run` record in the task’s history. Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



565
566
567
568
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 565

def get_tasks_id_logs(task_id, opts = {})
  data, _status_code, _headers = get_tasks_id_logs_with_http_info(task_id, opts)
  data
end

#get_tasks_id_logs_with_http_info(task_id, opts = {}) ⇒ Array<(Logs, Integer, Hash)>

List logs for a task Lists all log events for a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). When a task runs, InfluxDB creates a &#x60;run&#x60; record in the task’s history. Logs associated with each run provide relevant log messages, timestamps, and the exit status of the &#x60;run&#x60; attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    Logs data, response status code and response headers



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
615
616
617
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 576

def get_tasks_id_logs_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_logs"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/logs'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_logs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_members(task_id, opts = {}) ⇒ ResourceMembers

List all task members *Deprecated*: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Lists all users that have the `member` role for the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



625
626
627
628
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 625

def get_tasks_id_members(task_id, opts = {})
  data, _status_code, _headers = get_tasks_id_members_with_http_info(task_id, opts)
  data
end

#get_tasks_id_members_with_http_info(task_id, opts = {}) ⇒ Array<(ResourceMembers, Integer, Hash)>

List all task members *Deprecated*: Tasks don&#39;t use &#x60;owner&#x60; and &#x60;member&#x60; roles. Use [&#x60;/api/v2/authorizations&#x60;](#tag/Authorizations-(API-tokens)) to assign user permissions. Lists all users that have the &#x60;member&#x60; role for the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    ResourceMembers data, response status code and response headers



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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 636

def get_tasks_id_members_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_members"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/members'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_members",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_owners(task_id, opts = {}) ⇒ ResourceOwners

List all owners of a task *Deprecated*: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Lists all users that have the `owner` role for the specified task.

Parameters:

  • task_id (String)

    A task ID. Specifies the task to retrieve owners for.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



685
686
687
688
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 685

def get_tasks_id_owners(task_id, opts = {})
  data, _status_code, _headers = get_tasks_id_owners_with_http_info(task_id, opts)
  data
end

#get_tasks_id_owners_with_http_info(task_id, opts = {}) ⇒ Array<(ResourceOwners, Integer, Hash)>

List all owners of a task *Deprecated*: Tasks don&#39;t use &#x60;owner&#x60; and &#x60;member&#x60; roles. Use [&#x60;/api/v2/authorizations&#x60;](#tag/Authorizations-(API-tokens)) to assign user permissions. Lists all users that have the &#x60;owner&#x60; role for the specified task.

Parameters:

  • task_id (String)

    A task ID. Specifies the task to retrieve owners for.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    ResourceOwners data, response status code and response headers



696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 696

def get_tasks_id_owners_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_owners"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/owners'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_owners",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_runs(task_id, opts = {}) ⇒ Runs

List runs for a task Lists runs for the specified [task](docs.influxdata.com/influxdb/latest/process-data/). To limit which task runs are returned, pass query parameters in your request. If you don't pass query parameters, InfluxDB returns all runs for the task up to the default `limit`.

Parameters:

Options Hash (opts):

Returns:



749
750
751
752
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 749

def get_tasks_id_runs(task_id, opts = {})
  data, _status_code, _headers = get_tasks_id_runs_with_http_info(task_id, opts)
  data
end

#get_tasks_id_runs_id(task_id, run_id, opts = {}) ⇒ Run

Retrieve a run for a task. Retrieves the specified run for the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



826
827
828
829
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 826

def get_tasks_id_runs_id(task_id, run_id, opts = {})
  data, _status_code, _headers = get_tasks_id_runs_id_with_http_info(task_id, run_id, opts)
  data
end

#get_tasks_id_runs_id_logs(task_id, run_id, opts = {}) ⇒ Logs

List logs for a run Lists all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. Use this endpoint to help analyze [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) performance and troubleshoot failed task runs.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



892
893
894
895
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 892

def get_tasks_id_runs_id_logs(task_id, run_id, opts = {})
  data, _status_code, _headers = get_tasks_id_runs_id_logs_with_http_info(task_id, run_id, opts)
  data
end

#get_tasks_id_runs_id_logs_with_http_info(task_id, run_id, opts = {}) ⇒ Array<(Logs, Integer, Hash)>

List logs for a run Lists all logs for a task run. A log is a list of run events with &#x60;runID&#x60;, &#x60;time&#x60;, and &#x60;message&#x60; properties. Use this endpoint to help analyze [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) performance and troubleshoot failed task runs.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    Logs data, response status code and response headers



904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 904

def get_tasks_id_runs_id_logs_with_http_info(task_id, run_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_runs_id_logs"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling TasksApi.get_tasks_id_runs_id_logs"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/runs/{runID}/logs'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s)).sub('{' + 'runID' + '}', CGI.escape(run_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_runs_id_logs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_runs_id_with_http_info(task_id, run_id, opts = {}) ⇒ Array<(Run, Integer, Hash)>

Retrieve a run for a task. Retrieves the specified run for the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    Run data, response status code and response headers



838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 838

def get_tasks_id_runs_id_with_http_info(task_id, run_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_runs_id"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling TasksApi.get_tasks_id_runs_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/runs/{runID}'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s)).sub('{' + 'runID' + '}', CGI.escape(run_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_runs_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_runs_with_http_info(task_id, opts = {}) ⇒ Array<(Runs, Integer, Hash)>

List runs for a task Lists runs for the specified [task](docs.influxdata.com/influxdb/latest/process-data/). To limit which task runs are returned, pass query parameters in your request. If you don&#39;t pass query parameters, InfluxDB returns all runs for the task up to the default &#x60;limit&#x60;.

Parameters:

Options Hash (opts):

Returns:

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

    Runs data, response status code and response headers



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 764

def get_tasks_id_runs_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id_runs"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TasksApi.get_tasks_id_runs, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TasksApi.get_tasks_id_runs, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/tasks/{taskID}/runs'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'afterTime'] = opts[:'after_time'] if !opts[:'after_time'].nil?
  query_params[:'beforeTime'] = opts[:'before_time'] if !opts[:'before_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id_runs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_id_with_http_info(task_id, opts = {}) ⇒ Array<(Task, Integer, Hash)>

Retrieve a task Retrieves the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task).

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    Task data, response status code and response headers



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
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 456

def get_tasks_id_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.get_tasks_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#get_tasks_with_http_info(opts = {}) ⇒ Array<(Tasks, Integer, Hash)>

List tasks Lists [tasks](docs.influxdata.com/influxdb/latest/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default &#x60;limit&#x60;. #### Related guide - [Process data with InfluxDB tasks](docs.influxdata.com/influxdb/latest/process-data/)

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    Tasks data, response status code and response headers



376
377
378
379
380
381
382
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
434
435
436
437
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 376

def get_tasks_with_http_info(opts = {})
  allowable_values = ["active", "inactive"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TasksApi.get_tasks, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TasksApi.get_tasks, must be greater than or equal to 1.'
  end

  allowable_values = ["basic", "system"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/tasks'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'user'] = opts[:'user'] if !opts[:'user'].nil?
  query_params[:'org'] = opts[:'org'] if !opts[:'org'].nil?
  query_params[:'orgID'] = opts[:'org_id'] if !opts[:'org_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.get_tasks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  return data, status_code, headers
end

#patch_tasks_id(task_id, task_update_request, opts = {}) ⇒ Task

Update a task Updates the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task), and then cancels all scheduled runs of the task. Use this endpoint to set, modify, or clear task properties–for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. #### Related guides - [Update a task](docs.influxdata.com/influxdb/latest/process-data/manage-tasks/update-task/) - [Task configuration options](docs.influxdata.com/influxdb/latest/process-data/task-options/)

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



958
959
960
961
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 958

def patch_tasks_id(task_id, task_update_request, opts = {})
  data, _status_code, _headers = patch_tasks_id_with_http_info(task_id, task_update_request, opts)
  data
end

#patch_tasks_id_with_http_info(task_id, task_update_request, opts = {}) ⇒ Array<(Task, Integer, Hash)>

Update a task Updates the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task), and then cancels all scheduled runs of the task. Use this endpoint to set, modify, or clear task properties–for example: &#x60;cron&#x60;, &#x60;name&#x60;, &#x60;flux&#x60;, &#x60;status&#x60;. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. #### Related guides - [Update a task](docs.influxdata.com/influxdb/latest/process-data/manage-tasks/update-task/) - [Task configuration options](docs.influxdata.com/influxdb/latest/process-data/task-options/)

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    Task data, response status code and response headers



970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 970

def patch_tasks_id_with_http_info(task_id, task_update_request, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.patch_tasks_id"
  end
  # verify the required parameter 'task_update_request' is set
  if @api_client.config.client_side_validation && task_update_request.nil?
    fail ArgumentError, "Missing the required parameter 'task_update_request' when calling TasksApi.patch_tasks_id"
  end
  # resource path
  local_var_path = '/tasks/{taskID}'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.patch_tasks_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  return data, status_code, headers
end

#post_tasks(task_create_request, opts = {}) ⇒ Task

Create a task Creates a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) and returns the task. Use this endpoint to create a scheduled task that runs a script. #### Related guides - [Get started with tasks](docs.influxdata.com/influxdb/latest/process-data/get-started/) - [Create a task](docs.influxdata.com/influxdb/latest/process-data/manage-tasks/create-task/) - [Common tasks](docs.influxdata.com/influxdb/latest/process-data/common-tasks/) - [Task configuration options](docs.influxdata.com/influxdb/latest/process-data/task-options/)

Parameters:

  • task_create_request (TaskCreateRequest)

    In the request body, provide the task. #### InfluxDB OSS - Requires either the &#x60;org&#x60; parameter or the &#x60;orgID&#x60; parameter.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



1025
1026
1027
1028
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1025

def post_tasks(task_create_request, opts = {})
  data, _status_code, _headers = post_tasks_with_http_info(task_create_request, opts)
  data
end

#post_tasks_id_labels(task_id, label_mapping, opts = {}) ⇒ LabelResponse

Add a label to a task Adds a label to a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to add a label to a task. Labels are a way to add metadata to InfluxDB resources. You can use labels for grouping and filtering resources in the InfluxDB UI, `influx` CLI, and InfluxDB API.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



1088
1089
1090
1091
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1088

def post_tasks_id_labels(task_id, label_mapping, opts = {})
  data, _status_code, _headers = post_tasks_id_labels_with_http_info(task_id, label_mapping, opts)
  data
end

#post_tasks_id_labels_with_http_info(task_id, label_mapping, opts = {}) ⇒ Array<(LabelResponse, Integer, Hash)>

Add a label to a task Adds a label to a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to add a label to a task. Labels are a way to add metadata to InfluxDB resources. You can use labels for grouping and filtering resources in the InfluxDB UI, &#x60;influx&#x60; CLI, and InfluxDB API.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    LabelResponse data, response status code and response headers



1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1100

def post_tasks_id_labels_with_http_info(task_id, label_mapping, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.post_tasks_id_labels"
  end
  # verify the required parameter 'label_mapping' is set
  if @api_client.config.client_side_validation && label_mapping.nil?
    fail ArgumentError, "Missing the required parameter 'label_mapping' when calling TasksApi.post_tasks_id_labels"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/labels'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.post_tasks_id_labels",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  return data, status_code, headers
end

#post_tasks_id_members(task_id, add_resource_member_request_body, opts = {}) ⇒ ResourceMember

Add a member to a task *Deprecated*: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Adds a specified user to members of the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) and then returns the member.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



1156
1157
1158
1159
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1156

def post_tasks_id_members(task_id, add_resource_member_request_body, opts = {})
  data, _status_code, _headers = post_tasks_id_members_with_http_info(task_id, add_resource_member_request_body, opts)
  data
end

#post_tasks_id_members_with_http_info(task_id, add_resource_member_request_body, opts = {}) ⇒ Array<(ResourceMember, Integer, Hash)>

Add a member to a task *Deprecated*: Tasks don&#39;t use &#x60;owner&#x60; and &#x60;member&#x60; roles. Use [&#x60;/api/v2/authorizations&#x60;](#tag/Authorizations-(API-tokens)) to assign user permissions. Adds a specified user to members of the specified [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) and then returns the member.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    ResourceMember data, response status code and response headers



1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1168

def post_tasks_id_members_with_http_info(task_id, add_resource_member_request_body, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.post_tasks_id_members"
  end
  # verify the required parameter 'add_resource_member_request_body' is set
  if @api_client.config.client_side_validation && add_resource_member_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'add_resource_member_request_body' when calling TasksApi.post_tasks_id_members"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/members'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.post_tasks_id_members",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  return data, status_code, headers
end

#post_tasks_id_owners(task_id, add_resource_member_request_body, opts = {}) ⇒ ResourceOwner

Add an owner for a task *Deprecated*: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Adds a specified user to owners of the specified task and then returns the owner. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:



1224
1225
1226
1227
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1224

def post_tasks_id_owners(task_id, add_resource_member_request_body, opts = {})
  data, _status_code, _headers = post_tasks_id_owners_with_http_info(task_id, add_resource_member_request_body, opts)
  data
end

#post_tasks_id_owners_with_http_info(task_id, add_resource_member_request_body, opts = {}) ⇒ Array<(ResourceOwner, Integer, Hash)>

Add an owner for a task *Deprecated*: Tasks don&#39;t use &#x60;owner&#x60; and &#x60;member&#x60; roles. Use [&#x60;/api/v2/authorizations&#x60;](#tag/Authorizations-(API-tokens)) to assign user permissions. Adds a specified user to owners of the specified task and then returns the owner. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with &#x60;role: owner&#x60; for a specific resource.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    ResourceOwner data, response status code and response headers



1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1236

def post_tasks_id_owners_with_http_info(task_id, add_resource_member_request_body, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.post_tasks_id_owners"
  end
  # verify the required parameter 'add_resource_member_request_body' is set
  if @api_client.config.client_side_validation && add_resource_member_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'add_resource_member_request_body' when calling TasksApi.post_tasks_id_owners"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/owners'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.post_tasks_id_owners",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  return data, status_code, headers
end

#post_tasks_id_runs(task_id, opts = {}) ⇒ Run

Start a task run, overriding the schedule Schedules a task run to start immediately, ignoring scheduled runs. Use this endpoint to manually start a task run. Scheduled runs will continue to run as scheduled. This may result in concurrently running tasks. To retry a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/taskID/runs/runID/retry` endpoint](#operation/PostTasksIDRunsIDRetry). #### Limitations - Queuing a task run requires that the task's `status` property be set to `active`.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

  • :run_manually (RunManually)

Returns:



1292
1293
1294
1295
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1292

def post_tasks_id_runs(task_id, opts = {})
  data, _status_code, _headers = post_tasks_id_runs_with_http_info(task_id, opts)
  data
end

#post_tasks_id_runs_id_retry(task_id, run_id, opts = {}) ⇒ Run

Retry a task run Queues a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to retry and then returns the scheduled run. To manually start a new task run, use the [`POST /api/v2/tasks/taskID/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - Queuing a task run requires that the task's `status` property be set to `active`.

Parameters:

  • task_id (String)

    A task ID. Specifies the [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the task run belongs to.

  • run_id (String)

    A task run ID. Specifies the task run to retry. To find a task run ID, use the [&#x60;GET /api/v2/tasks/taskID/runs&#x60; endpoint](#operation/GetTasksIDRuns) to list task runs.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

  • :body (Object)

Returns:



1357
1358
1359
1360
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1357

def post_tasks_id_runs_id_retry(task_id, run_id, opts = {})
  data, _status_code, _headers = post_tasks_id_runs_id_retry_with_http_info(task_id, run_id, opts)
  data
end

#post_tasks_id_runs_id_retry_with_http_info(task_id, run_id, opts = {}) ⇒ Array<(Run, Integer, Hash)>

Retry a task run Queues a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to retry and then returns the scheduled run. To manually start a new task run, use the [&#x60;POST /api/v2/tasks/taskID/runs&#x60; endpoint](#operation/PostTasksIDRuns). #### Limitations - Queuing a task run requires that the task&#39;s &#x60;status&#x60; property be set to &#x60;active&#x60;.

Parameters:

  • task_id (String)

    A task ID. Specifies the [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the task run belongs to.

  • run_id (String)

    A task run ID. Specifies the task run to retry. To find a task run ID, use the [&#x60;GET /api/v2/tasks/taskID/runs&#x60; endpoint](#operation/GetTasksIDRuns) to list task runs.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

  • :body (Object)

Returns:

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

    Run data, response status code and response headers



1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1370

def post_tasks_id_runs_id_retry_with_http_info(task_id, run_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.post_tasks_id_runs_id_retry"
  end
  # verify the required parameter 'run_id' is set
  if @api_client.config.client_side_validation && run_id.nil?
    fail ArgumentError, "Missing the required parameter 'run_id' when calling TasksApi.post_tasks_id_runs_id_retry"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/runs/{runID}/retry'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s)).sub('{' + 'runID' + '}', CGI.escape(run_id.to_s))

  # 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; charset=utf-8'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.post_tasks_id_runs_id_retry",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  return data, status_code, headers
end

#post_tasks_id_runs_with_http_info(task_id, opts = {}) ⇒ Array<(Run, Integer, Hash)>

Start a task run, overriding the schedule Schedules a task run to start immediately, ignoring scheduled runs. Use this endpoint to manually start a task run. Scheduled runs will continue to run as scheduled. This may result in concurrently running tasks. To retry a previous run (and avoid creating a new run), use the [&#x60;POST /api/v2/tasks/taskID/runs/runID/retry&#x60; endpoint](#operation/PostTasksIDRunsIDRetry). #### Limitations - Queuing a task run requires that the task&#39;s &#x60;status&#x60; property be set to &#x60;active&#x60;.

Parameters:

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

  • :run_manually (RunManually)

Returns:

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

    Run data, response status code and response headers



1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1304

def post_tasks_id_runs_with_http_info(task_id, opts = {})
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling TasksApi.post_tasks_id_runs"
  end
  # resource path
  local_var_path = '/tasks/{taskID}/runs'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.post_tasks_id_runs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  return data, status_code, headers
end

#post_tasks_with_http_info(task_create_request, opts = {}) ⇒ Array<(Task, Integer, Hash)>

Create a task Creates a [task](docs.influxdata.com/influxdb/latest/reference/glossary/#task) and returns the task. Use this endpoint to create a scheduled task that runs a script. #### Related guides - [Get started with tasks](docs.influxdata.com/influxdb/latest/process-data/get-started/) - [Create a task](docs.influxdata.com/influxdb/latest/process-data/manage-tasks/create-task/) - [Common tasks](docs.influxdata.com/influxdb/latest/process-data/common-tasks/) - [Task configuration options](docs.influxdata.com/influxdb/latest/process-data/task-options/)

Parameters:

  • task_create_request (TaskCreateRequest)

    In the request body, provide the task. #### InfluxDB OSS - Requires either the &#x60;org&#x60; parameter or the &#x60;orgID&#x60; parameter.

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

    the optional parameters

Options Hash (opts):

  • :zap_trace_span (String)

    OpenTracing span context

Returns:

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

    Task data, response status code and response headers



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'apis/lib/influxdb2/apis/generated/api/tasks_api.rb', line 1036

def post_tasks_with_http_info(task_create_request, opts = {})
  # verify the required parameter 'task_create_request' is set
  if @api_client.config.client_side_validation && task_create_request.nil?
    fail ArgumentError, "Missing the required parameter 'task_create_request' when calling TasksApi.post_tasks"
  end
  # resource path
  local_var_path = '/tasks'

  # 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'])
  header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['header']

  new_options = opts.merge(
    :operation => :"TasksApi.post_tasks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  return data, status_code, headers
end