Class: Dkron::JobsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/dkron-rb/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-rb/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-rb/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

Returns:



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

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

Returns:

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

    Job data, response status code and response headers



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

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 = {}

  # 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:



78
79
80
81
# File 'lib/dkron-rb/api/jobs_api.rb', line 78

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



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

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):

  • :tags (Array<String>)

    Filter jobs by tags

Returns:



130
131
132
133
# File 'lib/dkron-rb/api/jobs_api.rb', line 130

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):

  • :tags (Array<String>)

    Filter jobs by tags

Returns:

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

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



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

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[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].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

#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:



179
180
181
182
# File 'lib/dkron-rb/api/jobs_api.rb', line 179

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



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

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:



231
232
233
234
# File 'lib/dkron-rb/api/jobs_api.rb', line 231

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



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

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:



283
284
285
286
# File 'lib/dkron-rb/api/jobs_api.rb', line 283

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



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
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/dkron-rb/api/jobs_api.rb', line 292

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