Class: Dkron::JobsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/dkron-ruby/api/jobs_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ JobsApi

Returns a new instance of JobsApi.



19
20
21
# File 'lib/dkron-ruby/api/jobs_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/dkron-ruby/api/jobs_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_or_update_job(body, opts = {}) ⇒ Job

Create or updates a new job.

Parameters:

  • body

    Updated job object

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

    the optional parameters

Options Hash (opts):

  • :runoncreate (BOOLEAN)

    If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.

Returns:



27
28
29
30
# File 'lib/dkron-ruby/api/jobs_api.rb', line 27

def create_or_update_job(body, opts = {})
  data, _status_code, _headers = create_or_update_job_with_http_info(body, opts)
  data
end

#create_or_update_job_with_http_info(body, opts = {}) ⇒ Array<(Job, Fixnum, Hash)>

Create or updates a new job.

Parameters:

  • body

    Updated job object

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

    the optional parameters

Options Hash (opts):

  • :runoncreate (BOOLEAN)

    If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.

Returns:

  • (Array<(Job, Fixnum, Hash)>)

    Job data, response status code and response headers



37
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
# File 'lib/dkron-ruby/api/jobs_api.rb', line 37

def create_or_update_job_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.create_or_update_job ...'
  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 JobsApi.create_or_update_job"
  end
  # resource path
  local_var_path = '/jobs'

  # query parameters
  query_params = {}
  query_params[:'runoncreate'] = opts[:'runoncreate'] if !opts[:'runoncreate'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Job')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#create_or_update_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_job(job_name, opts = {}) ⇒ Job

Delete a job.

Parameters:

  • job_name

    The job that needs to be deleted.

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

    the optional parameters

Returns:



81
82
83
84
# File 'lib/dkron-ruby/api/jobs_api.rb', line 81

def delete_job(job_name, opts = {})
  data, _status_code, _headers = delete_job_with_http_info(job_name, opts)
  data
end

#delete_job_with_http_info(job_name, opts = {}) ⇒ Array<(Job, Fixnum, Hash)>

Delete a job.

Parameters:

  • job_name

    The job that needs to be deleted.

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

    the optional parameters

Returns:

  • (Array<(Job, Fixnum, Hash)>)

    Job data, response status code and response headers



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/dkron-ruby/api/jobs_api.rb', line 90

def delete_job_with_http_info(job_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.delete_job ...'
  end
  # verify the required parameter 'job_name' is set
  if @api_client.config.client_side_validation && job_name.nil?
    fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.delete_job"
  end
  # resource path
  local_var_path = '/jobs/{job_name}'.sub('{' + 'job_name' + '}', job_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Job')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#delete_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_jobs(opts = {}) ⇒ Array<Job>

List jobs.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :metadata (Array<String>)

    Filter jobs by metadata

Returns:



133
134
135
136
# File 'lib/dkron-ruby/api/jobs_api.rb', line 133

def get_jobs(opts = {})
  data, _status_code, _headers = get_jobs_with_http_info(opts)
  data
end

#get_jobs_with_http_info(opts = {}) ⇒ Array<(Array<Job>, Fixnum, Hash)>

List jobs.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :metadata (Array<String>)

    Filter jobs by metadata

Returns:

  • (Array<(Array<Job>, Fixnum, Hash)>)

    Array<Job> data, response status code and response headers



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/dkron-ruby/api/jobs_api.rb', line 142

def get_jobs_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.get_jobs ...'
  end
  # resource path
  local_var_path = '/jobs'

  # query parameters
  query_params = {}
  query_params[:'metadata'] = @api_client.build_collection_param(opts[:'metadata'], :multi) if !opts[:'metadata'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Job>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#get_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#restore(file, opts = {}) ⇒ Array<Restore>

Restore jobs from json file.

Parameters:

  • file

    Json file that needs to be restored.

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

    the optional parameters

Returns:



182
183
184
185
# File 'lib/dkron-ruby/api/jobs_api.rb', line 182

def restore(file, opts = {})
  data, _status_code, _headers = restore_with_http_info(file, opts)
  data
end

#restore_with_http_info(file, opts = {}) ⇒ Array<(Array<Restore>, Fixnum, Hash)>

Restore jobs from json file.

Parameters:

  • file

    Json file that needs to be restored.

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

    the optional parameters

Returns:

  • (Array<(Array<Restore>, Fixnum, Hash)>)

    Array<Restore> data, response status code and response headers



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/dkron-ruby/api/jobs_api.rb', line 191

def restore_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.restore ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling JobsApi.restore"
  end
  # resource path
  local_var_path = '/restore'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}
  form_params['file'] = file

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Restore>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#restore\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#run_job(job_name, opts = {}) ⇒ Job

Executes a job.

Parameters:

  • job_name

    The job that needs to be run.

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

    the optional parameters

Returns:



235
236
237
238
# File 'lib/dkron-ruby/api/jobs_api.rb', line 235

def run_job(job_name, opts = {})
  data, _status_code, _headers = run_job_with_http_info(job_name, opts)
  data
end

#run_job_with_http_info(job_name, opts = {}) ⇒ Array<(Job, Fixnum, Hash)>

Executes a job.

Parameters:

  • job_name

    The job that needs to be run.

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

    the optional parameters

Returns:

  • (Array<(Job, Fixnum, Hash)>)

    Job data, response status code and response headers



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/dkron-ruby/api/jobs_api.rb', line 244

def run_job_with_http_info(job_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.run_job ...'
  end
  # verify the required parameter 'job_name' is set
  if @api_client.config.client_side_validation && job_name.nil?
    fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.run_job"
  end
  # resource path
  local_var_path = '/jobs/{job_name}'.sub('{' + 'job_name' + '}', job_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Job')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#run_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#show_job_by_name(job_name, opts = {}) ⇒ Job

Show a job.

Parameters:

  • job_name

    The job that needs to be fetched.

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

    the optional parameters

Returns:



287
288
289
290
# File 'lib/dkron-ruby/api/jobs_api.rb', line 287

def show_job_by_name(job_name, opts = {})
  data, _status_code, _headers = show_job_by_name_with_http_info(job_name, opts)
  data
end

#show_job_by_name_with_http_info(job_name, opts = {}) ⇒ Array<(Job, Fixnum, Hash)>

Show a job.

Parameters:

  • job_name

    The job that needs to be fetched.

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

    the optional parameters

Returns:

  • (Array<(Job, Fixnum, Hash)>)

    Job data, response status code and response headers



296
297
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
# File 'lib/dkron-ruby/api/jobs_api.rb', line 296

def show_job_by_name_with_http_info(job_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.show_job_by_name ...'
  end
  # verify the required parameter 'job_name' is set
  if @api_client.config.client_side_validation && job_name.nil?
    fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.show_job_by_name"
  end
  # resource path
  local_var_path = '/jobs/{job_name}'.sub('{' + 'job_name' + '}', job_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Job')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#show_job_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#toggle_job(job_name, opts = {}) ⇒ Job

Toggle a job.

Parameters:

  • job_name

    The job that needs to be toggled.

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

    the optional parameters

Returns:



339
340
341
342
# File 'lib/dkron-ruby/api/jobs_api.rb', line 339

def toggle_job(job_name, opts = {})
  data, _status_code, _headers = toggle_job_with_http_info(job_name, opts)
  data
end

#toggle_job_with_http_info(job_name, opts = {}) ⇒ Array<(Job, Fixnum, Hash)>

Toggle a job.

Parameters:

  • job_name

    The job that needs to be toggled.

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

    the optional parameters

Returns:

  • (Array<(Job, Fixnum, Hash)>)

    Job data, response status code and response headers



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
# File 'lib/dkron-ruby/api/jobs_api.rb', line 348

def toggle_job_with_http_info(job_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobsApi.toggle_job ...'
  end
  # verify the required parameter 'job_name' is set
  if @api_client.config.client_side_validation && job_name.nil?
    fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.toggle_job"
  end
  # resource path
  local_var_path = '/jobs/{job_name}/toggle'.sub('{' + 'job_name' + '}', job_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Job')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobsApi#toggle_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end