dkron-rb 1.0.0 → 1.1.0

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +7 -4
  4. data/Rakefile +0 -0
  5. data/dkron-rb.gemspec +2 -1
  6. data/docs/DefaultApi.md +82 -1
  7. data/docs/Execution.md +0 -0
  8. data/docs/ExecutionsApi.md +0 -0
  9. data/docs/Job.md +5 -2
  10. data/docs/JobsApi.md +65 -4
  11. data/docs/Member.md +0 -0
  12. data/docs/MembersApi.md +0 -0
  13. data/docs/Processors.md +0 -0
  14. data/docs/{ExecutorConfig.md → Restore.md} +1 -1
  15. data/docs/Status.md +3 -3
  16. data/git_push.sh +0 -0
  17. data/lib/dkron-rb.rb +2 -2
  18. data/lib/dkron-rb/api/default_api.rb +93 -2
  19. data/lib/dkron-rb/api/executions_api.rb +1 -1
  20. data/lib/dkron-rb/api/jobs_api.rb +75 -4
  21. data/lib/dkron-rb/api/members_api.rb +1 -1
  22. data/lib/dkron-rb/api_client.rb +6 -4
  23. data/lib/dkron-rb/api_error.rb +1 -1
  24. data/lib/dkron-rb/configuration.rb +3 -3
  25. data/lib/dkron-rb/models/execution.rb +3 -2
  26. data/lib/dkron-rb/models/job.rb +44 -8
  27. data/lib/dkron-rb/models/member.rb +3 -2
  28. data/lib/dkron-rb/models/processors.rb +3 -2
  29. data/lib/dkron-rb/models/{executor_config.rb → restore.rb} +5 -4
  30. data/lib/dkron-rb/models/status.rb +6 -5
  31. data/lib/dkron-rb/version.rb +2 -2
  32. data/spec/api/default_api_spec.rb +21 -1
  33. data/spec/api/executions_api_spec.rb +1 -1
  34. data/spec/api/jobs_api_spec.rb +19 -2
  35. data/spec/api/members_api_spec.rb +1 -1
  36. data/spec/api_client_spec.rb +18 -1
  37. data/spec/configuration_spec.rb +1 -1
  38. data/spec/models/execution_spec.rb +1 -1
  39. data/spec/models/job_spec.rb +19 -1
  40. data/spec/models/member_spec.rb +1 -1
  41. data/spec/models/processors_spec.rb +1 -1
  42. data/spec/models/{executor_config_spec.rb → restore_spec.rb} +7 -7
  43. data/spec/models/status_spec.rb +1 -1
  44. data/spec/spec_helper.rb +1 -1
  45. metadata +37 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e525a0fff59d56719b7dcd52ebebb35de2561bbbc053212f73e78cec344e6f2
4
- data.tar.gz: 3ac0326c956ab1a6947bfefeba6c748f9ef0c62bd39e145c17d8e04c60a43e58
3
+ metadata.gz: f9b80c7ffbe7b12bc924e1bd7e57aae5272d8663c832626dc2b424def6d5579c
4
+ data.tar.gz: 67a37d2dd0030bbddd96769e2bef2ea01247533cae9e070d12a97fdf819ade46
5
5
  SHA512:
6
- metadata.gz: 8af3e0af0cb5f73d2aeddff537d9102f480ec4d56277c03af5fec7c497c2f830b26ea1a78f90cd61fba283f2c305d9df795d7fd8424a4273fe6b8babb247873a
7
- data.tar.gz: bf534a2000f0966a41f3d51ac7245d207d3339201afe498e05ba10a2e520dd9e6d86ebb81ba2878160c4f697bbc3a0eac27d3d7dcb5c89115264d04f86407410
6
+ metadata.gz: 72ea52a4213b190d69b8b4cb84ee8f479f1a334cf857abd794a76dfc423e42f1642bc92522a6ac00d32747964d5af02d3d4590a99fc272ab827e32b6d3609522
7
+ data.tar.gz: 73c0a9dc55d876bb1d8d9126a81fb02d5f370a341db5eb15fcbb5f7ff92f01569b5d02c356e08f15b19f58ac3d2eb975ef8ecf8a6d861e398755712c4c33b608
data/Gemfile CHANGED
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development, :test do
6
- gem 'rake', '~> 12.0.0'
6
+ gem 'rake', '~> 12.3.3'
7
7
  end
data/README.md CHANGED
@@ -57,10 +57,10 @@ require 'dkron-rb'
57
57
  api_instance = Dkron::DefaultApi.new
58
58
 
59
59
  begin
60
- result = api_instance.get_leader
60
+ result = api_instance.busy
61
61
  p result
62
62
  rescue Dkron::ApiError => e
63
- puts "Exception when calling DefaultApi->get_leader: #{e}"
63
+ puts "Exception when calling DefaultApi->busy: #{e}"
64
64
  end
65
65
 
66
66
  ```
@@ -71,13 +71,16 @@ All URIs are relative to *http://localhost:8080/v1*
71
71
 
72
72
  Class | Method | HTTP request | Description
73
73
  ------------ | ------------- | ------------- | -------------
74
+ *Dkron::DefaultApi* | [**busy**](docs/DefaultApi.md#busy) | **GET** /busy |
75
+ *Dkron::DefaultApi* | [**get_is_leader**](docs/DefaultApi.md#get_is_leader) | **GET** /isleader |
74
76
  *Dkron::DefaultApi* | [**get_leader**](docs/DefaultApi.md#get_leader) | **GET** /leader |
75
- *Dkron::DefaultApi* | [**leave**](docs/DefaultApi.md#leave) | **GET** /leave |
77
+ *Dkron::DefaultApi* | [**leave**](docs/DefaultApi.md#leave) | **POST** /leave |
76
78
  *Dkron::DefaultApi* | [**status**](docs/DefaultApi.md#status) | **GET** / |
77
79
  *Dkron::ExecutionsApi* | [**list_executions_by_job**](docs/ExecutionsApi.md#list_executions_by_job) | **GET** /jobs/{job_name}/executions |
78
80
  *Dkron::JobsApi* | [**create_or_update_job**](docs/JobsApi.md#create_or_update_job) | **POST** /jobs |
79
81
  *Dkron::JobsApi* | [**delete_job**](docs/JobsApi.md#delete_job) | **DELETE** /jobs/{job_name} |
80
82
  *Dkron::JobsApi* | [**get_jobs**](docs/JobsApi.md#get_jobs) | **GET** /jobs |
83
+ *Dkron::JobsApi* | [**restore**](docs/JobsApi.md#restore) | **POST** /restore |
81
84
  *Dkron::JobsApi* | [**run_job**](docs/JobsApi.md#run_job) | **POST** /jobs/{job_name} |
82
85
  *Dkron::JobsApi* | [**show_job_by_name**](docs/JobsApi.md#show_job_by_name) | **GET** /jobs/{job_name} |
83
86
  *Dkron::JobsApi* | [**toggle_job**](docs/JobsApi.md#toggle_job) | **POST** /jobs/{job_name}/toggle |
@@ -87,10 +90,10 @@ Class | Method | HTTP request | Description
87
90
  ## Documentation for Models
88
91
 
89
92
  - [Dkron::Execution](docs/Execution.md)
90
- - [Dkron::ExecutorConfig](docs/ExecutorConfig.md)
91
93
  - [Dkron::Job](docs/Job.md)
92
94
  - [Dkron::Member](docs/Member.md)
93
95
  - [Dkron::Processors](docs/Processors.md)
96
+ - [Dkron::Restore](docs/Restore.md)
94
97
  - [Dkron::Status](docs/Status.md)
95
98
 
96
99
 
data/Rakefile CHANGED
File without changes
@@ -8,7 +8,7 @@
8
8
  OpenAPI spec version: 1
9
9
 
10
10
  Generated by: https://github.com/swagger-api/swagger-codegen.git
11
- Swagger Codegen version: 2.4.2
11
+ Swagger Codegen version: 2.4.18
12
12
 
13
13
  =end
14
14
 
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
 
30
30
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
31
  s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
+ s.add_runtime_dependency 'addressable', '~> 2.3', '>= 2.3.0'
32
33
 
33
34
  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
35
  s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
@@ -4,11 +4,92 @@ All URIs are relative to *http://localhost:8080/v1*
4
4
 
5
5
  Method | HTTP request | Description
6
6
  ------------- | ------------- | -------------
7
+ [**busy**](DefaultApi.md#busy) | **GET** /busy |
8
+ [**get_is_leader**](DefaultApi.md#get_is_leader) | **GET** /isleader |
7
9
  [**get_leader**](DefaultApi.md#get_leader) | **GET** /leader |
8
- [**leave**](DefaultApi.md#leave) | **GET** /leave |
10
+ [**leave**](DefaultApi.md#leave) | **POST** /leave |
9
11
  [**status**](DefaultApi.md#status) | **GET** / |
10
12
 
11
13
 
14
+ # **busy**
15
+ > Array<Execution> busy
16
+
17
+
18
+
19
+ Returns the running executions.
20
+
21
+ ### Example
22
+ ```ruby
23
+ # load the gem
24
+ require 'dkron-rb'
25
+
26
+ api_instance = Dkron::DefaultApi.new
27
+
28
+ begin
29
+ result = api_instance.busy
30
+ p result
31
+ rescue Dkron::ApiError => e
32
+ puts "Exception when calling DefaultApi->busy: #{e}"
33
+ end
34
+ ```
35
+
36
+ ### Parameters
37
+ This endpoint does not need any parameter.
38
+
39
+ ### Return type
40
+
41
+ [**Array<Execution>**](Execution.md)
42
+
43
+ ### Authorization
44
+
45
+ No authorization required
46
+
47
+ ### HTTP request headers
48
+
49
+ - **Content-Type**: application/json
50
+ - **Accept**: application/json
51
+
52
+
53
+
54
+ # **get_is_leader**
55
+ > get_is_leader
56
+
57
+
58
+
59
+ Check if node is a leader or follower.
60
+
61
+ ### Example
62
+ ```ruby
63
+ # load the gem
64
+ require 'dkron-rb'
65
+
66
+ api_instance = Dkron::DefaultApi.new
67
+
68
+ begin
69
+ api_instance.get_is_leader
70
+ rescue Dkron::ApiError => e
71
+ puts "Exception when calling DefaultApi->get_is_leader: #{e}"
72
+ end
73
+ ```
74
+
75
+ ### Parameters
76
+ This endpoint does not need any parameter.
77
+
78
+ ### Return type
79
+
80
+ nil (empty response body)
81
+
82
+ ### Authorization
83
+
84
+ No authorization required
85
+
86
+ ### HTTP request headers
87
+
88
+ - **Content-Type**: application/json
89
+ - **Accept**: application/json
90
+
91
+
92
+
12
93
  # **get_leader**
13
94
  > Member get_leader
14
95
 
File without changes
File without changes
@@ -3,7 +3,8 @@
3
3
  ## Properties
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
- **name** | **String** | Name for the job. |
6
+ **name** | **String** | Name for the job. Use only lower case letters (unicode), digits, underscore and dash. |
7
+ **displayname** | **String** | Nice name for the job. Optional. | [optional]
7
8
  **schedule** | **String** | Cron expression for the job. |
8
9
  **timezone** | **String** | Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time. | [optional]
9
10
  **owner** | **String** | Owner of the job | [optional]
@@ -14,12 +15,14 @@ Name | Type | Description | Notes
14
15
  **last_error** | **DateTime** | Last time this job failed | [optional]
15
16
  **disabled** | **BOOLEAN** | Disabled state of the job | [optional]
16
17
  **tags** | **Hash<String, String>** | Target nodes tags of this job | [optional]
18
+ **metadata** | **Hash<String, String>** | Extra metadata tags for this job | [optional]
17
19
  **retries** | **Integer** | Number of times to retry a failed job execution | [optional]
18
20
  **parent_job** | **String** | The name/id of the job that will trigger the execution of this job | [optional]
19
21
  **dependent_jobs** | **Array<String>** | Array containing the jobs that depends on this one | [optional]
20
22
  **processors** | [**Processors**](Processors.md) | | [optional]
21
23
  **concurrency** | **String** | Concurrency policy for the job allow/forbid | [optional]
22
24
  **executor** | **String** | Executor plugin used to run the job | [optional]
23
- **executor_config** | [**ExecutorConfig**](ExecutorConfig.md) | | [optional]
25
+ **executor_config** | **Hash<String, String>** | Executor plugin parameters | [optional]
26
+ **status** | **String** | Status of the job | [optional]
24
27
 
25
28
 
@@ -7,13 +7,14 @@ Method | HTTP request | Description
7
7
  [**create_or_update_job**](JobsApi.md#create_or_update_job) | **POST** /jobs |
8
8
  [**delete_job**](JobsApi.md#delete_job) | **DELETE** /jobs/{job_name} |
9
9
  [**get_jobs**](JobsApi.md#get_jobs) | **GET** /jobs |
10
+ [**restore**](JobsApi.md#restore) | **POST** /restore |
10
11
  [**run_job**](JobsApi.md#run_job) | **POST** /jobs/{job_name} |
11
12
  [**show_job_by_name**](JobsApi.md#show_job_by_name) | **GET** /jobs/{job_name} |
12
13
  [**toggle_job**](JobsApi.md#toggle_job) | **POST** /jobs/{job_name}/toggle |
13
14
 
14
15
 
15
16
  # **create_or_update_job**
16
- > Job create_or_update_job(body)
17
+ > Job create_or_update_job(body, opts)
17
18
 
18
19
 
19
20
 
@@ -28,9 +29,12 @@ api_instance = Dkron::JobsApi.new
28
29
 
29
30
  body = Dkron::Job.new # Job | Updated job object
30
31
 
32
+ opts = {
33
+ runoncreate: true # BOOLEAN | If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.
34
+ }
31
35
 
32
36
  begin
33
- result = api_instance.create_or_update_job(body)
37
+ result = api_instance.create_or_update_job(body, opts)
34
38
  p result
35
39
  rescue Dkron::ApiError => e
36
40
  puts "Exception when calling JobsApi->create_or_update_job: #{e}"
@@ -42,6 +46,7 @@ end
42
46
  Name | Type | Description | Notes
43
47
  ------------- | ------------- | ------------- | -------------
44
48
  **body** | [**Job**](Job.md)| Updated job object |
49
+ **runoncreate** | **BOOLEAN**| If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated. | [optional]
45
50
 
46
51
  ### Return type
47
52
 
@@ -119,7 +124,12 @@ require 'dkron-rb'
119
124
  api_instance = Dkron::JobsApi.new
120
125
 
121
126
  opts = {
122
- tags: ['tags_example'] # Array<String> | Filter jobs by tags
127
+ metadata: ['metadata_example'], # Array<String> | Filter jobs by metadata
128
+ _sort: '_sort_example', # String | Sorting field
129
+ _order: '_order_example', # String | Sort order (ASC/DESC)
130
+ q: 'q_example', # String | Filter query text
131
+ _start: 56, # Integer | Start index
132
+ _end: 56 # Integer | End index
123
133
  }
124
134
 
125
135
  begin
@@ -134,7 +144,12 @@ end
134
144
 
135
145
  Name | Type | Description | Notes
136
146
  ------------- | ------------- | ------------- | -------------
137
- **tags** | [**Array&lt;String&gt;**](String.md)| Filter jobs by tags | [optional]
147
+ **metadata** | [**Array&lt;String&gt;**](String.md)| Filter jobs by metadata | [optional]
148
+ **_sort** | **String**| Sorting field | [optional]
149
+ **_order** | **String**| Sort order (ASC/DESC) | [optional]
150
+ **q** | **String**| Filter query text | [optional]
151
+ **_start** | **Integer**| Start index | [optional]
152
+ **_end** | **Integer**| End index | [optional]
138
153
 
139
154
  ### Return type
140
155
 
@@ -151,6 +166,52 @@ No authorization required
151
166
 
152
167
 
153
168
 
169
+ # **restore**
170
+ > Array&lt;Restore&gt; restore(file)
171
+
172
+
173
+
174
+ Restore jobs from json file.
175
+
176
+ ### Example
177
+ ```ruby
178
+ # load the gem
179
+ require 'dkron-rb'
180
+
181
+ api_instance = Dkron::JobsApi.new
182
+
183
+ file = File.new('/path/to/file.txt') # File | Json file that needs to be restored.
184
+
185
+
186
+ begin
187
+ result = api_instance.restore(file)
188
+ p result
189
+ rescue Dkron::ApiError => e
190
+ puts "Exception when calling JobsApi->restore: #{e}"
191
+ end
192
+ ```
193
+
194
+ ### Parameters
195
+
196
+ Name | Type | Description | Notes
197
+ ------------- | ------------- | ------------- | -------------
198
+ **file** | **File**| Json file that needs to be restored. |
199
+
200
+ ### Return type
201
+
202
+ [**Array&lt;Restore&gt;**](Restore.md)
203
+
204
+ ### Authorization
205
+
206
+ No authorization required
207
+
208
+ ### HTTP request headers
209
+
210
+ - **Content-Type**: multipart/form-data
211
+ - **Accept**: application/json
212
+
213
+
214
+
154
215
  # **run_job**
155
216
  > Job run_job(job_name)
156
217
 
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- # Dkron::ExecutorConfig
1
+ # Dkron::Restore
2
2
 
3
3
  ## Properties
4
4
  Name | Type | Description | Notes
@@ -3,8 +3,8 @@
3
3
  ## Properties
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
- **agent** | [****](.md) | Node basic details | [optional]
7
- **serf** | [****](.md) | Serf status | [optional]
8
- **tags** | [****](.md) | Tags asociated with this node | [optional]
6
+ **agent** | **Object** | Node basic details | [optional]
7
+ **serf** | **Object** | Serf status | [optional]
8
+ **tags** | **Object** | Tags asociated with this node | [optional]
9
9
 
10
10
 
File without changes
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.2
9
+ Swagger Codegen version: 2.4.18
10
10
 
11
11
  =end
12
12
 
@@ -18,10 +18,10 @@ require 'dkron-rb/configuration'
18
18
 
19
19
  # Models
20
20
  require 'dkron-rb/models/execution'
21
- require 'dkron-rb/models/executor_config'
22
21
  require 'dkron-rb/models/job'
23
22
  require 'dkron-rb/models/member'
24
23
  require 'dkron-rb/models/processors'
24
+ require 'dkron-rb/models/restore'
25
25
  require 'dkron-rb/models/status'
26
26
 
27
27
  # APIs
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.2
9
+ Swagger Codegen version: 2.4.18
10
10
 
11
11
  =end
12
12
 
@@ -19,6 +19,97 @@ module Dkron
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Returns the running executions.
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [Array<Execution>]
25
+ def busy(opts = {})
26
+ data, _status_code, _headers = busy_with_http_info(opts)
27
+ data
28
+ end
29
+
30
+ # Returns the running executions.
31
+ # @param [Hash] opts the optional parameters
32
+ # @return [Array<(Array<Execution>, Fixnum, Hash)>] Array<Execution> data, response status code and response headers
33
+ def busy_with_http_info(opts = {})
34
+ if @api_client.config.debugging
35
+ @api_client.config.logger.debug 'Calling API: DefaultApi.busy ...'
36
+ end
37
+ # resource path
38
+ local_var_path = '/busy'
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 => 'Array<Execution>')
63
+ if @api_client.config.debugging
64
+ @api_client.config.logger.debug "API called: DefaultApi#busy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
65
+ end
66
+ return data, status_code, headers
67
+ end
68
+ # Check if node is a leader or follower.
69
+ # @param [Hash] opts the optional parameters
70
+ # @return [nil]
71
+ def get_is_leader(opts = {})
72
+ get_is_leader_with_http_info(opts)
73
+ nil
74
+ end
75
+
76
+ # Check if node is a leader or follower.
77
+ # @param [Hash] opts the optional parameters
78
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
79
+ def get_is_leader_with_http_info(opts = {})
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_is_leader ...'
82
+ end
83
+ # resource path
84
+ local_var_path = '/isleader'
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(:GET, 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
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug "API called: DefaultApi#get_is_leader\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
110
+ end
111
+ return data, status_code, headers
112
+ end
22
113
  # List leader of cluster.
23
114
  # @param [Hash] opts the optional parameters
24
115
  # @return [Member]
@@ -99,7 +190,7 @@ module Dkron
99
190
  # http body (model)
100
191
  post_body = nil
101
192
  auth_names = []
102
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
193
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
103
194
  :header_params => header_params,
104
195
  :query_params => query_params,
105
196
  :form_params => form_params,