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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e5c1c99c506acf44fdfc8106efba2d1067446d699aa80ddee769fcb21ba0ea09
4
+ data.tar.gz: d72e1d5baf17941b8921f43a36ce95ad538c04d77dadad68e093fbb593361719
5
+ SHA512:
6
+ metadata.gz: ef40c019dff315153acb9661085188c753694b11c5253695a4331765f9c9dda7e913e12ba1f700daf31dd944aa3e384bfc927a1908783480c9a6b43eb898da5a
7
+ data.tar.gz: 735161cefbe15f060dcf3cc120e8ba375831d62d9e9d978e69a4aab271c503b1281b183e660955e5ddda570855e965a811bc2ce1b3dd4c0e401fe365bbc16439
data/DEVELOP.md ADDED
@@ -0,0 +1,596 @@
1
+ `POST` to https://generator.swagger.io/api/gen/clients/ruby
2
+ ```json
3
+ {
4
+ "options":{
5
+ "gemName":"dkron-ruby",
6
+ "moduleName":"Dkron"
7
+ },
8
+ "spec":{
9
+ "swagger":"2.0",
10
+ "basePath":"/v1",
11
+ "host":"localhost:8080",
12
+ "consumes":[
13
+ "application/json"
14
+ ],
15
+ "produces":[
16
+ "application/json"
17
+ ],
18
+ "schemes":[
19
+ "http"
20
+ ],
21
+ "info":{
22
+ "version":"2.2",
23
+ "title":"Dkron REST API",
24
+ "description":"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`.\n\nDkron 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.\n\nDefault API responses are unformatted JSON add the `pretty=true` param to format the response.\n"
25
+ },
26
+ "paths":{
27
+ "/":{
28
+ "get":{
29
+ "description":"Gets `Status` object.\n",
30
+ "operationId":"status",
31
+ "tags":[
32
+ "default"
33
+ ],
34
+ "responses":{
35
+ "200":{
36
+ "description":"Successful response",
37
+ "schema":{
38
+ "$ref":"#/definitions/status"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "/jobs":{
45
+ "get":{
46
+ "description":"List jobs.\n",
47
+ "parameters":[
48
+ {
49
+ "in":"query",
50
+ "name":"metadata",
51
+ "type":"array",
52
+ "collectionFormat":"multi",
53
+ "items":{
54
+ "type":"string"
55
+ },
56
+ "description":"Filter jobs by metadata"
57
+ }
58
+ ],
59
+ "operationId":"getJobs",
60
+ "tags":[
61
+ "jobs"
62
+ ],
63
+ "responses":{
64
+ "200":{
65
+ "description":"Successful response",
66
+ "schema":{
67
+ "type":"array",
68
+ "items":{
69
+ "$ref":"#/definitions/job"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "post":{
76
+ "description":"Create or updates a new job.\n",
77
+ "operationId":"createOrUpdateJob",
78
+ "tags":[
79
+ "jobs"
80
+ ],
81
+ "parameters":[
82
+ {
83
+ "in":"body",
84
+ "name":"body",
85
+ "description":"Updated job object",
86
+ "required":true,
87
+ "schema":{
88
+ "$ref":"#/definitions/job"
89
+ }
90
+ },
91
+ {
92
+ "in":"query",
93
+ "name":"runoncreate",
94
+ "description":"If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.",
95
+ "required":false,
96
+ "schema":{
97
+ "type":"boolean"
98
+ },
99
+ "allowEmptyValue":true
100
+ }
101
+ ],
102
+ "responses":{
103
+ "201":{
104
+ "description":"Successful response",
105
+ "schema":{
106
+ "$ref":"#/definitions/job"
107
+ }
108
+ }
109
+ }
110
+ }
111
+ },
112
+ "/jobs/{job_name}":{
113
+ "get":{
114
+ "description":"Show a job.\n",
115
+ "operationId":"showJobByName",
116
+ "tags":[
117
+ "jobs"
118
+ ],
119
+ "parameters":[
120
+ {
121
+ "in":"path",
122
+ "name":"job_name",
123
+ "description":"The job that needs to be fetched.",
124
+ "required":true,
125
+ "type":"string"
126
+ }
127
+ ],
128
+ "responses":{
129
+ "200":{
130
+ "description":"Successful response",
131
+ "schema":{
132
+ "$ref":"#/definitions/job"
133
+ }
134
+ }
135
+ }
136
+ },
137
+ "delete":{
138
+ "description":"Delete a job.\n",
139
+ "operationId":"deleteJob",
140
+ "tags":[
141
+ "jobs"
142
+ ],
143
+ "parameters":[
144
+ {
145
+ "in":"path",
146
+ "name":"job_name",
147
+ "description":"The job that needs to be deleted.",
148
+ "required":true,
149
+ "type":"string"
150
+ }
151
+ ],
152
+ "responses":{
153
+ "200":{
154
+ "description":"Successful response",
155
+ "schema":{
156
+ "$ref":"#/definitions/job"
157
+ }
158
+ }
159
+ }
160
+ },
161
+ "post":{
162
+ "description":"Executes a job.\n",
163
+ "operationId":"runJob",
164
+ "tags":[
165
+ "jobs"
166
+ ],
167
+ "parameters":[
168
+ {
169
+ "in":"path",
170
+ "name":"job_name",
171
+ "description":"The job that needs to be run.",
172
+ "required":true,
173
+ "type":"string"
174
+ }
175
+ ],
176
+ "responses":{
177
+ "202":{
178
+ "description":"Successful response",
179
+ "schema":{
180
+ "$ref":"#/definitions/job"
181
+ }
182
+ }
183
+ }
184
+ }
185
+ },
186
+ "/jobs/{job_name}/toggle":{
187
+ "post":{
188
+ "description":"Toggle a job.\n",
189
+ "operationId":"toggleJob",
190
+ "tags":[
191
+ "jobs"
192
+ ],
193
+ "parameters":[
194
+ {
195
+ "in":"path",
196
+ "name":"job_name",
197
+ "description":"The job that needs to be toggled.",
198
+ "required":true,
199
+ "type":"string"
200
+ }
201
+ ],
202
+ "responses":{
203
+ "200":{
204
+ "description":"Successful response",
205
+ "schema":{
206
+ "$ref":"#/definitions/job"
207
+ }
208
+ }
209
+ }
210
+ }
211
+ },
212
+ "/members":{
213
+ "get":{
214
+ "description":"List members.\n",
215
+ "operationId":"getMember",
216
+ "tags":[
217
+ "members"
218
+ ],
219
+ "responses":{
220
+ "200":{
221
+ "description":"Successful response",
222
+ "schema":{
223
+ "type":"array",
224
+ "items":{
225
+ "$ref":"#/definitions/member"
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ },
232
+ "/leader":{
233
+ "get":{
234
+ "description":"List leader of cluster.\n",
235
+ "operationId":"getLeader",
236
+ "tags":[
237
+ "default"
238
+ ],
239
+ "responses":{
240
+ "200":{
241
+ "description":"Successful response",
242
+ "schema":{
243
+ "$ref":"#/definitions/member"
244
+ }
245
+ }
246
+ }
247
+ }
248
+ },
249
+ "/leave":{
250
+ "post":{
251
+ "description":"Force the node to leave the cluster.\n",
252
+ "operationId":"leave",
253
+ "tags":[
254
+ "default"
255
+ ],
256
+ "responses":{
257
+ "200":{
258
+ "description":"Successful response",
259
+ "schema":{
260
+ "type":"array",
261
+ "items":{
262
+ "$ref":"#/definitions/member"
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+ },
269
+ "/jobs/{job_name}/executions":{
270
+ "get":{
271
+ "description":"List executions.\n",
272
+ "operationId":"listExecutionsByJob",
273
+ "tags":[
274
+ "executions"
275
+ ],
276
+ "parameters":[
277
+ {
278
+ "in":"path",
279
+ "name":"job_name",
280
+ "description":"The job that owns the executions to be fetched.",
281
+ "required":true,
282
+ "type":"string"
283
+ }
284
+ ],
285
+ "responses":{
286
+ "200":{
287
+ "description":"Successful response",
288
+ "schema":{
289
+ "type":"array",
290
+ "items":{
291
+ "$ref":"#/definitions/execution"
292
+ }
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ },
299
+ "definitions":{
300
+ "status":{
301
+ "type":"object",
302
+ "description":"Status represents details about the node.",
303
+ "readOnly":true,
304
+ "properties":{
305
+ "agent":{
306
+ "description":"Node basic details",
307
+ "readOnly":true,
308
+ "additionalProperties":{
309
+ "type":"object"
310
+ }
311
+ },
312
+ "serf":{
313
+ "description":"Serf status",
314
+ "readOnly":true,
315
+ "additionalProperties":{
316
+ "type":"object"
317
+ }
318
+ },
319
+ "tags":{
320
+ "description":"Tags asociated with this node",
321
+ "readOnly":true,
322
+ "additionalProperties":{
323
+ "type":"string"
324
+ }
325
+ }
326
+ }
327
+ },
328
+ "job":{
329
+ "type":"object",
330
+ "description":"A Job represents a scheduled task to execute.",
331
+ "required":[
332
+ "name",
333
+ "schedule"
334
+ ],
335
+ "properties":{
336
+ "name":{
337
+ "type":"string",
338
+ "description":"Name for the job.",
339
+ "readOnly":false,
340
+ "example":"job1"
341
+ },
342
+ "displayname":{
343
+ "type":"string",
344
+ "description":"Nice name for the job. Optional.",
345
+ "readOnly":false
346
+ },
347
+ "schedule":{
348
+ "type":"string",
349
+ "description":"Cron expression for the job.",
350
+ "readOnly":false,
351
+ "example":"@every 10s"
352
+ },
353
+ "timezone":{
354
+ "type":"string",
355
+ "description":"Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time.",
356
+ "readOnly":false,
357
+ "example":"Europe/Berlin"
358
+ },
359
+ "owner":{
360
+ "type":"string",
361
+ "description":"Owner of the job",
362
+ "readOnly":false,
363
+ "example":"Platform Team"
364
+ },
365
+ "owner_email":{
366
+ "type":"string",
367
+ "description":"Email of the owner",
368
+ "readOnly":false,
369
+ "example":"platform@example.com"
370
+ },
371
+ "success_count":{
372
+ "type":"integer",
373
+ "description":"Number of successful executions",
374
+ "readOnly":true
375
+ },
376
+ "error_count":{
377
+ "type":"integer",
378
+ "description":"Number of failed executions",
379
+ "readOnly":true
380
+ },
381
+ "last_success":{
382
+ "type":"string",
383
+ "format":"date-time",
384
+ "description":"Last time this job executed successfully",
385
+ "readOnly":true
386
+ },
387
+ "last_error":{
388
+ "type":"string",
389
+ "format":"date-time",
390
+ "description":"Last time this job failed",
391
+ "readOnly":true
392
+ },
393
+ "disabled":{
394
+ "type":"boolean",
395
+ "description":"Disabled state of the job",
396
+ "readOnly":false
397
+ },
398
+ "tags":{
399
+ "type":"object",
400
+ "description":"Target nodes tags of this job",
401
+ "additionalProperties":{
402
+ "type":"string"
403
+ },
404
+ "readOnly":false,
405
+ "example":{
406
+ "server":"true"
407
+ }
408
+ },
409
+ "metadata":{
410
+ "type":"object",
411
+ "description":"Extra metadata tags for this job",
412
+ "additionalProperties":{
413
+ "type":"string"
414
+ },
415
+ "readOnly":false,
416
+ "example":{
417
+ "office":"Barcelona"
418
+ }
419
+ },
420
+ "retries":{
421
+ "type":"integer",
422
+ "description":"Number of times to retry a failed job execution",
423
+ "example":2,
424
+ "readOnly":false
425
+ },
426
+ "parent_job":{
427
+ "type":"string",
428
+ "description":"The name/id of the job that will trigger the execution of this job",
429
+ "example":"parent_job",
430
+ "readOnly":false
431
+ },
432
+ "dependent_jobs":{
433
+ "type":"array",
434
+ "items":{
435
+ "type":"string"
436
+ },
437
+ "description":"Array containing the jobs that depends on this one",
438
+ "example":[
439
+ "dependent_job"
440
+ ],
441
+ "readOnly":true
442
+ },
443
+ "processors":{
444
+ "$ref":"#/definitions/processors"
445
+ },
446
+ "concurrency":{
447
+ "type":"string",
448
+ "description":"Concurrency policy for the job allow/forbid",
449
+ "example":"allow",
450
+ "readOnly":false
451
+ },
452
+ "executor":{
453
+ "type":"string",
454
+ "description":"Executor plugin used to run the job",
455
+ "readOnly":false,
456
+ "example":"shell"
457
+ },
458
+ "executor_config":{
459
+ "type":"object",
460
+ "description":"Executor plugin parameters",
461
+ "additionalProperties":{
462
+ "type":"string"
463
+ },
464
+ "example":{
465
+ "command":"echo 'Hello from Dkron'"
466
+ }
467
+ },
468
+ "status":{
469
+ "type":"string",
470
+ "readOnly":true,
471
+ "description":"Status of the job",
472
+ "example":"success"
473
+ }
474
+ }
475
+ },
476
+ "member":{
477
+ "type":"object",
478
+ "description":"A member represents a cluster member node.",
479
+ "properties":{
480
+ "Name":{
481
+ "type":"string",
482
+ "description":"Node name",
483
+ "example":"dkron1"
484
+ },
485
+ "Addr":{
486
+ "type":"string",
487
+ "description":"IP Address",
488
+ "example":"192.168.1.137"
489
+ },
490
+ "Port":{
491
+ "type":"integer",
492
+ "description":"Port number",
493
+ "example":8946
494
+ },
495
+ "Tags":{
496
+ "type":"object",
497
+ "description":"Tags asociated with this node",
498
+ "additionalProperties":{
499
+ "type":"string"
500
+ },
501
+ "example":{
502
+ "rpc_addr":"192.168.1.137:6868",
503
+ "server":"true",
504
+ "version\"":"1.0.0"
505
+ }
506
+ },
507
+ "Status":{
508
+ "type":"integer",
509
+ "description":"The serf status of the node see: https://godoc.org/github.com/hashicorp/serf/serf#MemberStatus",
510
+ "example":1
511
+ },
512
+ "ProtocolMin":{
513
+ "type":"integer",
514
+ "description":"Serf protocol minimum version this node can understand or speak",
515
+ "example":5
516
+ },
517
+ "ProtocolMax":{
518
+ "type":"integer",
519
+ "description":"Serf protocol maximum version this node can understand or speak",
520
+ "example":2
521
+ },
522
+ "ProtocolCur":{
523
+ "type":"integer",
524
+ "description":"Serf protocol current version this node can understand or speak",
525
+ "example":2
526
+ },
527
+ "DelegateMin":{
528
+ "type":"integer",
529
+ "description":"Serf delegate protocol minimum version this node can understand or speak"
530
+ },
531
+ "DelegateMax":{
532
+ "type":"integer",
533
+ "description":"Serf delegate protocol maximum version this node can understand or speak",
534
+ "example":5
535
+ },
536
+ "DelegateCur":{
537
+ "type":"integer",
538
+ "description":"Serf delegate protocol current version this node can understand or speak",
539
+ "example":4
540
+ }
541
+ }
542
+ },
543
+ "execution":{
544
+ "type":"object",
545
+ "description":"An execution represents a timed job run.",
546
+ "properties":{
547
+ "job_name":{
548
+ "type":"string",
549
+ "description":"job name",
550
+ "example":"job_1"
551
+ },
552
+ "started_at":{
553
+ "type":"string",
554
+ "format":"date-time",
555
+ "description":"start time of the execution"
556
+ },
557
+ "finished_at":{
558
+ "type":"string",
559
+ "format":"date-time",
560
+ "description":"when the execution finished running"
561
+ },
562
+ "success":{
563
+ "type":"boolean",
564
+ "description":"the execution run successfuly"
565
+ },
566
+ "output":{
567
+ "type":"string",
568
+ "description":"partial output of the command execution",
569
+ "example":"Hello from Dkron"
570
+ },
571
+ "node_name":{
572
+ "type":"string",
573
+ "description":"name of the node that executed the command",
574
+ "example":"dkron1"
575
+ }
576
+ }
577
+ },
578
+ "processors":{
579
+ "type":"object",
580
+ "description":"Processor plugins used to process executions results of this job",
581
+ "additionalProperties":{
582
+ "type":"object",
583
+ "additionalProperties":{
584
+ "type":"string"
585
+ }
586
+ },
587
+ "example":{
588
+ "files":{
589
+ "forward":true
590
+ }
591
+ }
592
+ }
593
+ }
594
+ }
595
+ }
596
+ ```