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:



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

def create_or_update_job(body, opts = {})
  data, _status_code, _headers = create_or_update_job_with_http_info(body, opts)
  return 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



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-rb/api/jobs_api.rb', line 38

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:



83
84
85
86
# File 'lib/dkron-rb/api/jobs_api.rb', line 83

def delete_job(job_name, opts = {})
  data, _status_code, _headers = delete_job_with_http_info(job_name, opts)
  return 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



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

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

Returns:



137
138
139
140
# File 'lib/dkron-rb/api/jobs_api.rb', line 137

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

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

List jobs.

Parameters:

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

    the optional parameters

Returns:

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

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



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

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

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



187
188
189
190
# File 'lib/dkron-rb/api/jobs_api.rb', line 187

def run_job(job_name, opts = {})
  data, _status_code, _headers = run_job_with_http_info(job_name, opts)
  return 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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/dkron-rb/api/jobs_api.rb', line 197

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:



242
243
244
245
# File 'lib/dkron-rb/api/jobs_api.rb', line 242

def show_job_by_name(job_name, opts = {})
  data, _status_code, _headers = show_job_by_name_with_http_info(job_name, opts)
  return 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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/dkron-rb/api/jobs_api.rb', line 252

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