dkron-rb 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +65 -0
  4. data/LICENSE +201 -0
  5. data/README.md +98 -0
  6. data/Rakefile +6 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/config.json +5 -0
  10. data/dkron-rb-0.0.1.gem +0 -0
  11. data/dkron-rb-0.0.2.gem +0 -0
  12. data/dkron-rb.gemspec +55 -0
  13. data/docs/Agent.md +7 -0
  14. data/docs/DefaultApi.md +131 -0
  15. data/docs/Execution.md +13 -0
  16. data/docs/ExecutionsApi.md +55 -0
  17. data/docs/InlineResponse200.md +10 -0
  18. data/docs/Job.md +24 -0
  19. data/docs/JobsApi.md +237 -0
  20. data/docs/MainApi.md +90 -0
  21. data/docs/Member.md +18 -0
  22. data/docs/MembersApi.md +49 -0
  23. data/docs/Serf.md +7 -0
  24. data/docs/Status.md +7 -0
  25. data/docs/Tags.md +7 -0
  26. data/git_push.sh +67 -0
  27. data/lib/dkron-rb.rb +47 -0
  28. data/lib/dkron-rb/api/default_api.rb +193 -0
  29. data/lib/dkron-rb/api/executions_api.rb +91 -0
  30. data/lib/dkron-rb/api/jobs_api.rb +315 -0
  31. data/lib/dkron-rb/api/members_api.rb +87 -0
  32. data/lib/dkron-rb/api_client.rb +378 -0
  33. data/lib/dkron-rb/api_error.rb +47 -0
  34. data/lib/dkron-rb/configuration.rb +207 -0
  35. data/lib/dkron-rb/cron.rb +152 -0
  36. data/lib/dkron-rb/models/agent.rb +152 -0
  37. data/lib/dkron-rb/models/execution.rb +250 -0
  38. data/lib/dkron-rb/models/inline_response_200.rb +181 -0
  39. data/lib/dkron-rb/models/job.rb +369 -0
  40. data/lib/dkron-rb/models/member.rb +301 -0
  41. data/lib/dkron-rb/models/serf.rb +152 -0
  42. data/lib/dkron-rb/models/status.rb +190 -0
  43. data/lib/dkron-rb/models/tags.rb +152 -0
  44. data/lib/dkron-rb/numeric_seconds.rb +48 -0
  45. data/lib/dkron-rb/version.rb +26 -0
  46. data/lib/dkron.rb +9 -0
  47. data/pkg/dkron-rb-0.9.2.gem +0 -0
  48. data/seeds.rb +18 -0
  49. data/spec/api/default_api_spec.rb +80 -0
  50. data/spec/api/executions_api_spec.rb +51 -0
  51. data/spec/api/jobs_api_spec.rb +114 -0
  52. data/spec/api/main_api_spec.rb +65 -0
  53. data/spec/api/members_api_spec.rb +50 -0
  54. data/spec/api_client_spec.rb +237 -0
  55. data/spec/configuration_spec.rb +53 -0
  56. data/spec/models/agent_spec.rb +36 -0
  57. data/spec/models/execution_spec.rb +96 -0
  58. data/spec/models/inline_response_200_spec.rb +66 -0
  59. data/spec/models/job_spec.rb +186 -0
  60. data/spec/models/member_spec.rb +146 -0
  61. data/spec/models/serf_spec.rb +36 -0
  62. data/spec/models/status_spec.rb +36 -0
  63. data/spec/models/tags_spec.rb +36 -0
  64. data/spec/spec_helper.rb +122 -0
  65. metadata +309 -0
@@ -0,0 +1,91 @@
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: 0.9.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require "uri"
25
+
26
+ module Dkron
27
+ class ExecutionsApi
28
+ attr_accessor :api_client
29
+
30
+ def initialize(api_client = ApiClient.default)
31
+ @api_client = api_client
32
+ end
33
+
34
+ #
35
+ # List executions.
36
+ # @param job_name The job that owns the executions to be fetched.
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<Execution>]
39
+ def list_executions_by_job(job_name, opts = {})
40
+ data, _status_code, _headers = list_executions_by_job_with_http_info(job_name, opts)
41
+ return data
42
+ end
43
+
44
+ #
45
+ # List executions.
46
+ # @param job_name The job that owns the executions to be fetched.
47
+ # @param [Hash] opts the optional parameters
48
+ # @return [Array<(Array<Execution>, Fixnum, Hash)>] Array<Execution> data, response status code and response headers
49
+ def list_executions_by_job_with_http_info(job_name, opts = {})
50
+ if @api_client.config.debugging
51
+ @api_client.config.logger.debug "Calling API: ExecutionsApi.list_executions_by_job ..."
52
+ end
53
+ # verify the required parameter 'job_name' is set
54
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling ExecutionsApi.list_executions_by_job" if job_name.nil?
55
+ # resource path
56
+ local_var_path = "/executions/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
57
+
58
+ # query parameters
59
+ query_params = {}
60
+
61
+ # header parameters
62
+ header_params = {}
63
+
64
+ # HTTP header 'Accept' (if needed)
65
+ local_header_accept = ['application/json']
66
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
67
+
68
+ # HTTP header 'Content-Type'
69
+ local_header_content_type = ['application/json']
70
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
71
+
72
+ # form parameters
73
+ form_params = {}
74
+
75
+ # http body (model)
76
+ post_body = nil
77
+ auth_names = []
78
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => 'Array<Execution>')
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: ExecutionsApi#list_executions_by_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,315 @@
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: 0.9.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require "uri"
25
+
26
+ module Dkron
27
+ class JobsApi
28
+ attr_accessor :api_client
29
+
30
+ def initialize(api_client = ApiClient.default)
31
+ @api_client = api_client
32
+ end
33
+
34
+ #
35
+ # Create or updates a new job.
36
+ # @param body Updated job object
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Job]
39
+ def create_or_update_job(body, opts = {})
40
+ data, _status_code, _headers = create_or_update_job_with_http_info(body, opts)
41
+ return data
42
+ end
43
+
44
+ #
45
+ # Create or updates a new job.
46
+ # @param body Updated job object
47
+ # @param [Hash] opts the optional parameters
48
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
49
+ def create_or_update_job_with_http_info(body, opts = {})
50
+ if @api_client.config.debugging
51
+ @api_client.config.logger.debug "Calling API: JobsApi.create_or_update_job ..."
52
+ end
53
+ # verify the required parameter 'body' is set
54
+ fail ArgumentError, "Missing the required parameter 'body' when calling JobsApi.create_or_update_job" if body.nil?
55
+ # resource path
56
+ local_var_path = "/jobs".sub('{format}','json')
57
+
58
+ # query parameters
59
+ query_params = {}
60
+
61
+ # header parameters
62
+ header_params = {}
63
+
64
+ # HTTP header 'Accept' (if needed)
65
+ local_header_accept = ['application/json']
66
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
67
+
68
+ # HTTP header 'Content-Type'
69
+ local_header_content_type = ['application/json']
70
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
71
+
72
+ # form parameters
73
+ form_params = {}
74
+
75
+ # http body (model)
76
+ post_body = @api_client.object_to_http_body(body)
77
+ auth_names = []
78
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => 'Job')
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: JobsApi#create_or_update_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+
91
+ #
92
+ # Delete a job.
93
+ # @param job_name The job that needs to be deleted.
94
+ # @param [Hash] opts the optional parameters
95
+ # @return [Job]
96
+ def delete_job(job_name, opts = {})
97
+ data, _status_code, _headers = delete_job_with_http_info(job_name, opts)
98
+ return data
99
+ end
100
+
101
+ #
102
+ # Delete a job.
103
+ # @param job_name The job that needs to be deleted.
104
+ # @param [Hash] opts the optional parameters
105
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
106
+ def delete_job_with_http_info(job_name, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug "Calling API: JobsApi.delete_job ..."
109
+ end
110
+ # verify the required parameter 'job_name' is set
111
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.delete_job" if job_name.nil?
112
+ # resource path
113
+ local_var_path = "/jobs/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
114
+
115
+ # query parameters
116
+ query_params = {}
117
+
118
+ # header parameters
119
+ header_params = {}
120
+
121
+ # HTTP header 'Accept' (if needed)
122
+ local_header_accept = ['application/json']
123
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
124
+
125
+ # HTTP header 'Content-Type'
126
+ local_header_content_type = ['application/json']
127
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
128
+
129
+ # form parameters
130
+ form_params = {}
131
+
132
+ # http body (model)
133
+ post_body = nil
134
+ auth_names = []
135
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
136
+ :header_params => header_params,
137
+ :query_params => query_params,
138
+ :form_params => form_params,
139
+ :body => post_body,
140
+ :auth_names => auth_names,
141
+ :return_type => 'Job')
142
+ if @api_client.config.debugging
143
+ @api_client.config.logger.debug "API called: JobsApi#delete_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
144
+ end
145
+ return data, status_code, headers
146
+ end
147
+
148
+ #
149
+ # List jobs.
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [Array<Job>]
152
+ def get_jobs(opts = {})
153
+ data, _status_code, _headers = get_jobs_with_http_info(opts)
154
+ return data
155
+ end
156
+
157
+ #
158
+ # List jobs.
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [Array<(Array<Job>, Fixnum, Hash)>] Array<Job> data, response status code and response headers
161
+ def get_jobs_with_http_info(opts = {})
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug "Calling API: JobsApi.get_jobs ..."
164
+ end
165
+ # resource path
166
+ local_var_path = "/jobs".sub('{format}','json')
167
+
168
+ # query parameters
169
+ query_params = {}
170
+
171
+ # header parameters
172
+ header_params = {}
173
+
174
+ # HTTP header 'Accept' (if needed)
175
+ local_header_accept = ['application/json']
176
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
177
+
178
+ # HTTP header 'Content-Type'
179
+ local_header_content_type = ['application/json']
180
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
181
+
182
+ # form parameters
183
+ form_params = {}
184
+
185
+ # http body (model)
186
+ post_body = nil
187
+ auth_names = []
188
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
189
+ :header_params => header_params,
190
+ :query_params => query_params,
191
+ :form_params => form_params,
192
+ :body => post_body,
193
+ :auth_names => auth_names,
194
+ :return_type => 'Array<Job>')
195
+ if @api_client.config.debugging
196
+ @api_client.config.logger.debug "API called: JobsApi#get_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
197
+ end
198
+ return data, status_code, headers
199
+ end
200
+
201
+ #
202
+ # Executes a job.
203
+ # @param job_name The job that needs to be run.
204
+ # @param [Hash] opts the optional parameters
205
+ # @return [Job]
206
+ def run_job(job_name, opts = {})
207
+ data, _status_code, _headers = run_job_with_http_info(job_name, opts)
208
+ return data
209
+ end
210
+
211
+ #
212
+ # Executes a job.
213
+ # @param job_name The job that needs to be run.
214
+ # @param [Hash] opts the optional parameters
215
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
216
+ def run_job_with_http_info(job_name, opts = {})
217
+ if @api_client.config.debugging
218
+ @api_client.config.logger.debug "Calling API: JobsApi.run_job ..."
219
+ end
220
+ # verify the required parameter 'job_name' is set
221
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.run_job" if job_name.nil?
222
+ # resource path
223
+ local_var_path = "/jobs/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
224
+
225
+ # query parameters
226
+ query_params = {}
227
+
228
+ # header parameters
229
+ header_params = {}
230
+
231
+ # HTTP header 'Accept' (if needed)
232
+ local_header_accept = ['application/json']
233
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
234
+
235
+ # HTTP header 'Content-Type'
236
+ local_header_content_type = ['application/json']
237
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
238
+
239
+ # form parameters
240
+ form_params = {}
241
+
242
+ # http body (model)
243
+ post_body = nil
244
+ auth_names = []
245
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
246
+ :header_params => header_params,
247
+ :query_params => query_params,
248
+ :form_params => form_params,
249
+ :body => post_body,
250
+ :auth_names => auth_names,
251
+ :return_type => 'Job')
252
+ if @api_client.config.debugging
253
+ @api_client.config.logger.debug "API called: JobsApi#run_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
254
+ end
255
+ return data, status_code, headers
256
+ end
257
+
258
+ #
259
+ # Show a job.
260
+ # @param job_name The job that needs to be fetched.
261
+ # @param [Hash] opts the optional parameters
262
+ # @return [Job]
263
+ def show_job_by_name(job_name, opts = {})
264
+ data, _status_code, _headers = show_job_by_name_with_http_info(job_name, opts)
265
+ return data
266
+ end
267
+
268
+ #
269
+ # Show a job.
270
+ # @param job_name The job that needs to be fetched.
271
+ # @param [Hash] opts the optional parameters
272
+ # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
273
+ def show_job_by_name_with_http_info(job_name, opts = {})
274
+ if @api_client.config.debugging
275
+ @api_client.config.logger.debug "Calling API: JobsApi.show_job_by_name ..."
276
+ end
277
+ # verify the required parameter 'job_name' is set
278
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.show_job_by_name" if job_name.nil?
279
+ # resource path
280
+ local_var_path = "/jobs/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
281
+
282
+ # query parameters
283
+ query_params = {}
284
+
285
+ # header parameters
286
+ header_params = {}
287
+
288
+ # HTTP header 'Accept' (if needed)
289
+ local_header_accept = ['application/json']
290
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
291
+
292
+ # HTTP header 'Content-Type'
293
+ local_header_content_type = ['application/json']
294
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
295
+
296
+ # form parameters
297
+ form_params = {}
298
+
299
+ # http body (model)
300
+ post_body = nil
301
+ auth_names = []
302
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
303
+ :header_params => header_params,
304
+ :query_params => query_params,
305
+ :form_params => form_params,
306
+ :body => post_body,
307
+ :auth_names => auth_names,
308
+ :return_type => 'Job')
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug "API called: JobsApi#show_job_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
311
+ end
312
+ return data, status_code, headers
313
+ end
314
+ end
315
+ end
@@ -0,0 +1,87 @@
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: 0.9.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require "uri"
25
+
26
+ module Dkron
27
+ class MembersApi
28
+ attr_accessor :api_client
29
+
30
+ def initialize(api_client = ApiClient.default)
31
+ @api_client = api_client
32
+ end
33
+
34
+ #
35
+ # List members.
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Array<Member>]
38
+ def get_member(opts = {})
39
+ data, _status_code, _headers = get_member_with_http_info(opts)
40
+ return data
41
+ end
42
+
43
+ #
44
+ # List members.
45
+ # @param [Hash] opts the optional parameters
46
+ # @return [Array<(Array<Member>, Fixnum, Hash)>] Array<Member> data, response status code and response headers
47
+ def get_member_with_http_info(opts = {})
48
+ if @api_client.config.debugging
49
+ @api_client.config.logger.debug "Calling API: MembersApi.get_member ..."
50
+ end
51
+ # resource path
52
+ local_var_path = "/members".sub('{format}','json')
53
+
54
+ # query parameters
55
+ query_params = {}
56
+
57
+ # header parameters
58
+ header_params = {}
59
+
60
+ # HTTP header 'Accept' (if needed)
61
+ local_header_accept = ['application/json']
62
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
63
+
64
+ # HTTP header 'Content-Type'
65
+ local_header_content_type = ['application/json']
66
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
67
+
68
+ # form parameters
69
+ form_params = {}
70
+
71
+ # http body (model)
72
+ post_body = nil
73
+ auth_names = []
74
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => 'Array<Member>')
81
+ if @api_client.config.debugging
82
+ @api_client.config.logger.debug "API called: MembersApi#get_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
83
+ end
84
+ return data, status_code, headers
85
+ end
86
+ end
87
+ end