dkron-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/DEVELOP.md +596 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +69 -0
  5. data/README.md +99 -0
  6. data/Rakefile +8 -0
  7. data/dkron-ruby.gemspec +45 -0
  8. data/docs/DefaultApi.md +131 -0
  9. data/docs/Execution.md +13 -0
  10. data/docs/ExecutionsApi.md +55 -0
  11. data/docs/Job.md +28 -0
  12. data/docs/JobsApi.md +295 -0
  13. data/docs/Member.md +18 -0
  14. data/docs/MembersApi.md +49 -0
  15. data/docs/Processors.md +7 -0
  16. data/docs/Status.md +10 -0
  17. data/git_push.sh +55 -0
  18. data/lib/dkron-ruby.rb +48 -0
  19. data/lib/dkron-ruby/api/default_api.rb +161 -0
  20. data/lib/dkron-ruby/api/executions_api.rb +75 -0
  21. data/lib/dkron-ruby/api/jobs_api.rb +335 -0
  22. data/lib/dkron-ruby/api/members_api.rb +69 -0
  23. data/lib/dkron-ruby/api_client.rb +390 -0
  24. data/lib/dkron-ruby/api_error.rb +38 -0
  25. data/lib/dkron-ruby/configuration.rb +202 -0
  26. data/lib/dkron-ruby/models/execution.rb +236 -0
  27. data/lib/dkron-ruby/models/job.rb +403 -0
  28. data/lib/dkron-ruby/models/member.rb +288 -0
  29. data/lib/dkron-ruby/models/processors.rb +176 -0
  30. data/lib/dkron-ruby/models/status.rb +206 -0
  31. data/lib/dkron-ruby/version.rb +15 -0
  32. data/spec/api/default_api_spec.rb +65 -0
  33. data/spec/api/executions_api_spec.rb +46 -0
  34. data/spec/api/jobs_api_spec.rb +102 -0
  35. data/spec/api/members_api_spec.rb +45 -0
  36. data/spec/api_client_spec.rb +243 -0
  37. data/spec/configuration_spec.rb +42 -0
  38. data/spec/models/execution_spec.rb +71 -0
  39. data/spec/models/job_spec.rb +161 -0
  40. data/spec/models/member_spec.rb +101 -0
  41. data/spec/models/processors_spec.rb +35 -0
  42. data/spec/models/status_spec.rb +53 -0
  43. data/spec/spec_helper.rb +111 -0
  44. metadata +283 -0
@@ -0,0 +1,161 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Dkron
16
+ class DefaultApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List leader of cluster.
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [Member]
25
+ def get_leader(opts = {})
26
+ data, _status_code, _headers = get_leader_with_http_info(opts)
27
+ data
28
+ end
29
+
30
+ # List leader of cluster.
31
+ # @param [Hash] opts the optional parameters
32
+ # @return [Array<(Member, Fixnum, Hash)>] Member data, response status code and response headers
33
+ def get_leader_with_http_info(opts = {})
34
+ if @api_client.config.debugging
35
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_leader ...'
36
+ end
37
+ # resource path
38
+ local_var_path = '/leader'
39
+
40
+ # query parameters
41
+ query_params = {}
42
+
43
+ # header parameters
44
+ header_params = {}
45
+ # HTTP header 'Accept' (if needed)
46
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
47
+ # HTTP header 'Content-Type'
48
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
49
+
50
+ # form parameters
51
+ form_params = {}
52
+
53
+ # http body (model)
54
+ post_body = nil
55
+ auth_names = []
56
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
57
+ :header_params => header_params,
58
+ :query_params => query_params,
59
+ :form_params => form_params,
60
+ :body => post_body,
61
+ :auth_names => auth_names,
62
+ :return_type => 'Member')
63
+ if @api_client.config.debugging
64
+ @api_client.config.logger.debug "API called: DefaultApi#get_leader\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
65
+ end
66
+ return data, status_code, headers
67
+ end
68
+ # Force the node to leave the cluster.
69
+ # @param [Hash] opts the optional parameters
70
+ # @return [Array<Member>]
71
+ def leave(opts = {})
72
+ data, _status_code, _headers = leave_with_http_info(opts)
73
+ data
74
+ end
75
+
76
+ # Force the node to leave the cluster.
77
+ # @param [Hash] opts the optional parameters
78
+ # @return [Array<(Array<Member>, Fixnum, Hash)>] Array<Member> data, response status code and response headers
79
+ def leave_with_http_info(opts = {})
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug 'Calling API: DefaultApi.leave ...'
82
+ end
83
+ # resource path
84
+ local_var_path = '/leave'
85
+
86
+ # query parameters
87
+ query_params = {}
88
+
89
+ # header parameters
90
+ header_params = {}
91
+ # HTTP header 'Accept' (if needed)
92
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
93
+ # HTTP header 'Content-Type'
94
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
95
+
96
+ # form parameters
97
+ form_params = {}
98
+
99
+ # http body (model)
100
+ post_body = nil
101
+ auth_names = []
102
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
103
+ :header_params => header_params,
104
+ :query_params => query_params,
105
+ :form_params => form_params,
106
+ :body => post_body,
107
+ :auth_names => auth_names,
108
+ :return_type => 'Array<Member>')
109
+ if @api_client.config.debugging
110
+ @api_client.config.logger.debug "API called: DefaultApi#leave\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
111
+ end
112
+ return data, status_code, headers
113
+ end
114
+ # Gets `Status` object.
115
+ # @param [Hash] opts the optional parameters
116
+ # @return [Status]
117
+ def status(opts = {})
118
+ data, _status_code, _headers = status_with_http_info(opts)
119
+ data
120
+ end
121
+
122
+ # Gets &#x60;Status&#x60; object.
123
+ # @param [Hash] opts the optional parameters
124
+ # @return [Array<(Status, Fixnum, Hash)>] Status data, response status code and response headers
125
+ def status_with_http_info(opts = {})
126
+ if @api_client.config.debugging
127
+ @api_client.config.logger.debug 'Calling API: DefaultApi.status ...'
128
+ end
129
+ # resource path
130
+ local_var_path = '/'
131
+
132
+ # query parameters
133
+ query_params = {}
134
+
135
+ # header parameters
136
+ header_params = {}
137
+ # HTTP header 'Accept' (if needed)
138
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
139
+ # HTTP header 'Content-Type'
140
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
141
+
142
+ # form parameters
143
+ form_params = {}
144
+
145
+ # http body (model)
146
+ post_body = nil
147
+ auth_names = []
148
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
149
+ :header_params => header_params,
150
+ :query_params => query_params,
151
+ :form_params => form_params,
152
+ :body => post_body,
153
+ :auth_names => auth_names,
154
+ :return_type => 'Status')
155
+ if @api_client.config.debugging
156
+ @api_client.config.logger.debug "API called: DefaultApi#status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
157
+ end
158
+ return data, status_code, headers
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,75 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Dkron
16
+ class ExecutionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List executions.
23
+ # @param job_name The job that owns the executions to be fetched.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Array<Execution>]
26
+ def list_executions_by_job(job_name, opts = {})
27
+ data, _status_code, _headers = list_executions_by_job_with_http_info(job_name, opts)
28
+ data
29
+ end
30
+
31
+ # List executions.
32
+ # @param job_name The job that owns the executions to be fetched.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Array<Execution>, Fixnum, Hash)>] Array<Execution> data, response status code and response headers
35
+ def list_executions_by_job_with_http_info(job_name, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: ExecutionsApi.list_executions_by_job ...'
38
+ end
39
+ # verify the required parameter 'job_name' is set
40
+ if @api_client.config.client_side_validation && job_name.nil?
41
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling ExecutionsApi.list_executions_by_job"
42
+ end
43
+ # resource path
44
+ local_var_path = '/jobs/{job_name}/executions'.sub('{' + 'job_name' + '}', job_name.to_s)
45
+
46
+ # query parameters
47
+ query_params = {}
48
+
49
+ # header parameters
50
+ header_params = {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
53
+ # HTTP header 'Content-Type'
54
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
55
+
56
+ # form parameters
57
+ form_params = {}
58
+
59
+ # http body (model)
60
+ post_body = nil
61
+ auth_names = []
62
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
63
+ :header_params => header_params,
64
+ :query_params => query_params,
65
+ :form_params => form_params,
66
+ :body => post_body,
67
+ :auth_names => auth_names,
68
+ :return_type => 'Array<Execution>')
69
+ if @api_client.config.debugging
70
+ @api_client.config.logger.debug "API called: ExecutionsApi#list_executions_by_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
71
+ end
72
+ return data, status_code, headers
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,335 @@
1
+ =begin
2
+ #Dkron REST API
3
+
4
+ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
+
6
+ OpenAPI spec version: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Dkron
16
+ class JobsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create or updates a new job.
23
+ # @param body Updated job object
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Object] :runoncreate If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.
26
+ # @return [Job]
27
+ def create_or_update_job(body, opts = {})
28
+ data, _status_code, _headers = create_or_update_job_with_http_info(body, opts)
29
+ data
30
+ end
31
+
32
+ # Create or updates a new job.
33
+ # @param body Updated job object
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [Object] :runoncreate If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.
36
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
37
+ def create_or_update_job_with_http_info(body, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: JobsApi.create_or_update_job ...'
40
+ end
41
+ # verify the required parameter 'body' is set
42
+ if @api_client.config.client_side_validation && body.nil?
43
+ fail ArgumentError, "Missing the required parameter 'body' when calling JobsApi.create_or_update_job"
44
+ end
45
+ # resource path
46
+ local_var_path = '/jobs'
47
+
48
+ # query parameters
49
+ query_params = {}
50
+ query_params[:'runoncreate'] = opts[:'runoncreate'] if !opts[:'runoncreate'].nil?
51
+
52
+ # header parameters
53
+ header_params = {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
56
+ # HTTP header 'Content-Type'
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
58
+
59
+ # form parameters
60
+ form_params = {}
61
+
62
+ # http body (model)
63
+ post_body = @api_client.object_to_http_body(body)
64
+ auth_names = []
65
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
66
+ :header_params => header_params,
67
+ :query_params => query_params,
68
+ :form_params => form_params,
69
+ :body => post_body,
70
+ :auth_names => auth_names,
71
+ :return_type => 'Job')
72
+ if @api_client.config.debugging
73
+ @api_client.config.logger.debug "API called: JobsApi#create_or_update_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
74
+ end
75
+ return data, status_code, headers
76
+ end
77
+ # Delete a job.
78
+ # @param job_name The job that needs to be deleted.
79
+ # @param [Hash] opts the optional parameters
80
+ # @return [Job]
81
+ def delete_job(job_name, opts = {})
82
+ data, _status_code, _headers = delete_job_with_http_info(job_name, opts)
83
+ data
84
+ end
85
+
86
+ # Delete a job.
87
+ # @param job_name The job that needs to be deleted.
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
90
+ def delete_job_with_http_info(job_name, opts = {})
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug 'Calling API: JobsApi.delete_job ...'
93
+ end
94
+ # verify the required parameter 'job_name' is set
95
+ if @api_client.config.client_side_validation && job_name.nil?
96
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.delete_job"
97
+ end
98
+ # resource path
99
+ local_var_path = '/jobs/{job_name}'.sub('{' + 'job_name' + '}', job_name.to_s)
100
+
101
+ # query parameters
102
+ query_params = {}
103
+
104
+ # header parameters
105
+ header_params = {}
106
+ # HTTP header 'Accept' (if needed)
107
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
108
+ # HTTP header 'Content-Type'
109
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
110
+
111
+ # form parameters
112
+ form_params = {}
113
+
114
+ # http body (model)
115
+ post_body = nil
116
+ auth_names = []
117
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
118
+ :header_params => header_params,
119
+ :query_params => query_params,
120
+ :form_params => form_params,
121
+ :body => post_body,
122
+ :auth_names => auth_names,
123
+ :return_type => 'Job')
124
+ if @api_client.config.debugging
125
+ @api_client.config.logger.debug "API called: JobsApi#delete_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
126
+ end
127
+ return data, status_code, headers
128
+ end
129
+ # List jobs.
130
+ # @param [Hash] opts the optional parameters
131
+ # @option opts [Array<String>] :metadata Filter jobs by metadata
132
+ # @return [Array<Job>]
133
+ def get_jobs(opts = {})
134
+ data, _status_code, _headers = get_jobs_with_http_info(opts)
135
+ data
136
+ end
137
+
138
+ # List jobs.
139
+ # @param [Hash] opts the optional parameters
140
+ # @option opts [Array<String>] :metadata Filter jobs by metadata
141
+ # @return [Array<(Array<Job>, Fixnum, Hash)>] Array<Job> data, response status code and response headers
142
+ def get_jobs_with_http_info(opts = {})
143
+ if @api_client.config.debugging
144
+ @api_client.config.logger.debug 'Calling API: JobsApi.get_jobs ...'
145
+ end
146
+ # resource path
147
+ local_var_path = '/jobs'
148
+
149
+ # query parameters
150
+ query_params = {}
151
+ query_params[:'metadata'] = @api_client.build_collection_param(opts[:'metadata'], :multi) if !opts[:'metadata'].nil?
152
+
153
+ # header parameters
154
+ header_params = {}
155
+ # HTTP header 'Accept' (if needed)
156
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
157
+ # HTTP header 'Content-Type'
158
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
159
+
160
+ # form parameters
161
+ form_params = {}
162
+
163
+ # http body (model)
164
+ post_body = nil
165
+ auth_names = []
166
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
167
+ :header_params => header_params,
168
+ :query_params => query_params,
169
+ :form_params => form_params,
170
+ :body => post_body,
171
+ :auth_names => auth_names,
172
+ :return_type => 'Array<Job>')
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug "API called: JobsApi#get_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
175
+ end
176
+ return data, status_code, headers
177
+ end
178
+ # Executes a job.
179
+ # @param job_name The job that needs to be run.
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [Job]
182
+ def run_job(job_name, opts = {})
183
+ data, _status_code, _headers = run_job_with_http_info(job_name, opts)
184
+ data
185
+ end
186
+
187
+ # Executes a job.
188
+ # @param job_name The job that needs to be run.
189
+ # @param [Hash] opts the optional parameters
190
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
191
+ def run_job_with_http_info(job_name, opts = {})
192
+ if @api_client.config.debugging
193
+ @api_client.config.logger.debug 'Calling API: JobsApi.run_job ...'
194
+ end
195
+ # verify the required parameter 'job_name' is set
196
+ if @api_client.config.client_side_validation && job_name.nil?
197
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.run_job"
198
+ end
199
+ # resource path
200
+ local_var_path = '/jobs/{job_name}'.sub('{' + 'job_name' + '}', job_name.to_s)
201
+
202
+ # query parameters
203
+ query_params = {}
204
+
205
+ # header parameters
206
+ header_params = {}
207
+ # HTTP header 'Accept' (if needed)
208
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
209
+ # HTTP header 'Content-Type'
210
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
211
+
212
+ # form parameters
213
+ form_params = {}
214
+
215
+ # http body (model)
216
+ post_body = nil
217
+ auth_names = []
218
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => 'Job')
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug "API called: JobsApi#run_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
227
+ end
228
+ return data, status_code, headers
229
+ end
230
+ # Show a job.
231
+ # @param job_name The job that needs to be fetched.
232
+ # @param [Hash] opts the optional parameters
233
+ # @return [Job]
234
+ def show_job_by_name(job_name, opts = {})
235
+ data, _status_code, _headers = show_job_by_name_with_http_info(job_name, opts)
236
+ data
237
+ end
238
+
239
+ # Show a job.
240
+ # @param job_name The job that needs to be fetched.
241
+ # @param [Hash] opts the optional parameters
242
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
243
+ def show_job_by_name_with_http_info(job_name, opts = {})
244
+ if @api_client.config.debugging
245
+ @api_client.config.logger.debug 'Calling API: JobsApi.show_job_by_name ...'
246
+ end
247
+ # verify the required parameter 'job_name' is set
248
+ if @api_client.config.client_side_validation && job_name.nil?
249
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.show_job_by_name"
250
+ end
251
+ # resource path
252
+ local_var_path = '/jobs/{job_name}'.sub('{' + 'job_name' + '}', job_name.to_s)
253
+
254
+ # query parameters
255
+ query_params = {}
256
+
257
+ # header parameters
258
+ header_params = {}
259
+ # HTTP header 'Accept' (if needed)
260
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
261
+ # HTTP header 'Content-Type'
262
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
263
+
264
+ # form parameters
265
+ form_params = {}
266
+
267
+ # http body (model)
268
+ post_body = nil
269
+ auth_names = []
270
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
271
+ :header_params => header_params,
272
+ :query_params => query_params,
273
+ :form_params => form_params,
274
+ :body => post_body,
275
+ :auth_names => auth_names,
276
+ :return_type => 'Job')
277
+ if @api_client.config.debugging
278
+ @api_client.config.logger.debug "API called: JobsApi#show_job_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
+ end
280
+ return data, status_code, headers
281
+ end
282
+ # Toggle a job.
283
+ # @param job_name The job that needs to be toggled.
284
+ # @param [Hash] opts the optional parameters
285
+ # @return [Job]
286
+ def toggle_job(job_name, opts = {})
287
+ data, _status_code, _headers = toggle_job_with_http_info(job_name, opts)
288
+ data
289
+ end
290
+
291
+ # Toggle a job.
292
+ # @param job_name The job that needs to be toggled.
293
+ # @param [Hash] opts the optional parameters
294
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
295
+ def toggle_job_with_http_info(job_name, opts = {})
296
+ if @api_client.config.debugging
297
+ @api_client.config.logger.debug 'Calling API: JobsApi.toggle_job ...'
298
+ end
299
+ # verify the required parameter 'job_name' is set
300
+ if @api_client.config.client_side_validation && job_name.nil?
301
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.toggle_job"
302
+ end
303
+ # resource path
304
+ local_var_path = '/jobs/{job_name}/toggle'.sub('{' + 'job_name' + '}', job_name.to_s)
305
+
306
+ # query parameters
307
+ query_params = {}
308
+
309
+ # header parameters
310
+ header_params = {}
311
+ # HTTP header 'Accept' (if needed)
312
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
313
+ # HTTP header 'Content-Type'
314
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
315
+
316
+ # form parameters
317
+ form_params = {}
318
+
319
+ # http body (model)
320
+ post_body = nil
321
+ auth_names = []
322
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
323
+ :header_params => header_params,
324
+ :query_params => query_params,
325
+ :form_params => form_params,
326
+ :body => post_body,
327
+ :auth_names => auth_names,
328
+ :return_type => 'Job')
329
+ if @api_client.config.debugging
330
+ @api_client.config.logger.debug "API called: JobsApi#toggle_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
331
+ end
332
+ return data, status_code, headers
333
+ end
334
+ end
335
+ end