dkron-rb 0.9.2 → 0.10.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +30 -28
  4. data/README.md +13 -8
  5. data/Rakefile +9 -3
  6. data/config.json +1 -1
  7. data/dkron-rb.gemspec +8 -17
  8. data/docs/DefaultApi.md +1 -1
  9. data/docs/ExecutionsApi.md +1 -1
  10. data/docs/ExecutorConfig.md +7 -0
  11. data/docs/ExecutorShell.md +10 -0
  12. data/docs/Job.md +5 -4
  13. data/docs/Member.md +3 -3
  14. data/docs/ProcessorFiles.md +9 -0
  15. data/docs/ProcessorLog.md +8 -0
  16. data/docs/ProcessorSyslog.md +8 -0
  17. data/docs/Processors.md +7 -0
  18. data/git_push.sh +1 -13
  19. data/lib/dkron-rb.rb +10 -4
  20. data/lib/dkron-rb/api/default_api.rb +13 -36
  21. data/lib/dkron-rb/api/executions_api.rb +8 -21
  22. data/lib/dkron-rb/api/jobs_api.rb +29 -52
  23. data/lib/dkron-rb/api/members_api.rb +5 -20
  24. data/lib/dkron-rb/api_client.rb +55 -45
  25. data/lib/dkron-rb/api_error.rb +9 -18
  26. data/lib/dkron-rb/configuration.rb +8 -13
  27. data/lib/dkron-rb/models/execution.rb +6 -17
  28. data/lib/dkron-rb/models/executor_config.rb +179 -0
  29. data/lib/dkron-rb/models/executor_shell.rb +208 -0
  30. data/lib/dkron-rb/models/job.rb +48 -46
  31. data/lib/dkron-rb/models/member.rb +10 -20
  32. data/lib/dkron-rb/models/processor_files.rb +198 -0
  33. data/lib/dkron-rb/models/processor_log.rb +189 -0
  34. data/lib/dkron-rb/models/processor_syslog.rb +189 -0
  35. data/lib/dkron-rb/models/processors.rb +179 -0
  36. data/lib/dkron-rb/models/status.rb +6 -17
  37. data/lib/dkron-rb/version.rb +3 -14
  38. data/pkg/dkron-rb-0.9.2.gem +0 -0
  39. data/seeds.rb +5 -2
  40. data/spec/models/executor_config_spec.rb +36 -0
  41. data/spec/models/executor_shell_spec.rb +54 -0
  42. data/spec/models/processor_files_spec.rb +48 -0
  43. data/spec/models/processor_log_spec.rb +42 -0
  44. data/spec/models/processor_syslog_spec.rb +42 -0
  45. data/spec/models/processors_spec.rb +36 -0
  46. metadata +46 -25
  47. data/dkron-rb-0.0.1.gem +0 -0
  48. data/dkron-rb-0.0.2.gem +0 -0
@@ -3,21 +3,10 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -32,11 +21,8 @@ module Dkron
32
21
  # Cron expression for the job.
33
22
  attr_accessor :schedule
34
23
 
35
- # Command to run.
36
- attr_accessor :command
37
-
38
- # Use shell to run the command
39
- attr_accessor :shell
24
+ # Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time.
25
+ attr_accessor :timezone
40
26
 
41
27
  # Owner of the job
42
28
  attr_accessor :owner
@@ -71,20 +57,23 @@ module Dkron
71
57
  # Array containing the jobs that depends on this one
72
58
  attr_accessor :dependent_jobs
73
59
 
74
- # Processor plugins used to process executions results of this job
75
60
  attr_accessor :processors
76
61
 
77
62
  # Concurrency policy for the job allow/forbid
78
63
  attr_accessor :concurrency
79
64
 
65
+ # Executor plugin used to run the job
66
+ attr_accessor :executor
67
+
68
+ attr_accessor :executor_config
69
+
80
70
 
81
71
  # Attribute mapping from ruby-style variable name to JSON key.
82
72
  def self.attribute_map
83
73
  {
84
74
  :'name' => :'name',
85
75
  :'schedule' => :'schedule',
86
- :'command' => :'command',
87
- :'shell' => :'shell',
76
+ :'timezone' => :'timezone',
88
77
  :'owner' => :'owner',
89
78
  :'owner_email' => :'owner_email',
90
79
  :'success_count' => :'success_count',
@@ -97,7 +86,9 @@ module Dkron
97
86
  :'parent_job' => :'parent_job',
98
87
  :'dependent_jobs' => :'dependent_jobs',
99
88
  :'processors' => :'processors',
100
- :'concurrency' => :'concurrency'
89
+ :'concurrency' => :'concurrency',
90
+ :'executor' => :'executor',
91
+ :'executor_config' => :'executor_config'
101
92
  }
102
93
  end
103
94
 
@@ -106,8 +97,7 @@ module Dkron
106
97
  {
107
98
  :'name' => :'String',
108
99
  :'schedule' => :'String',
109
- :'command' => :'String',
110
- :'shell' => :'BOOLEAN',
100
+ :'timezone' => :'String',
111
101
  :'owner' => :'String',
112
102
  :'owner_email' => :'String',
113
103
  :'success_count' => :'Integer',
@@ -118,9 +108,11 @@ module Dkron
118
108
  :'tags' => :'Hash<String, String>',
119
109
  :'retries' => :'Integer',
120
110
  :'parent_job' => :'String',
121
- :'dependent_jobs' => :'Array<null>',
122
- :'processors' => :'Hash<String, String>',
123
- :'concurrency' => :'String'
111
+ :'dependent_jobs' => :'Array<String>',
112
+ :'processors' => :'Processors',
113
+ :'concurrency' => :'String',
114
+ :'executor' => :'String',
115
+ :'executor_config' => :'ExecutorConfig'
124
116
  }
125
117
  end
126
118
 
@@ -140,12 +132,8 @@ module Dkron
140
132
  self.schedule = attributes[:'schedule']
141
133
  end
142
134
 
143
- if attributes.has_key?(:'command')
144
- self.command = attributes[:'command']
145
- end
146
-
147
- if attributes.has_key?(:'shell')
148
- self.shell = attributes[:'shell']
135
+ if attributes.has_key?(:'timezone')
136
+ self.timezone = attributes[:'timezone']
149
137
  end
150
138
 
151
139
  if attributes.has_key?(:'owner')
@@ -177,7 +165,7 @@ module Dkron
177
165
  end
178
166
 
179
167
  if attributes.has_key?(:'tags')
180
- if (value = attributes[:'tags']).is_a?(Array)
168
+ if (value = attributes[:'tags']).is_a?(Hash)
181
169
  self.tags = value
182
170
  end
183
171
  end
@@ -197,21 +185,35 @@ module Dkron
197
185
  end
198
186
 
199
187
  if attributes.has_key?(:'processors')
200
- if (value = attributes[:'processors']).is_a?(Array)
201
- self.processors = value
202
- end
188
+ self.processors = attributes[:'processors']
203
189
  end
204
190
 
205
191
  if attributes.has_key?(:'concurrency')
206
192
  self.concurrency = attributes[:'concurrency']
207
193
  end
208
194
 
195
+ if attributes.has_key?(:'executor')
196
+ self.executor = attributes[:'executor']
197
+ end
198
+
199
+ if attributes.has_key?(:'executor_config')
200
+ self.executor_config = attributes[:'executor_config']
201
+ end
202
+
209
203
  end
210
204
 
211
205
  # Show invalid properties with the reasons. Usually used together with valid?
212
- # @return Array for valid properies with the reasons
206
+ # @return Array for valid properties with the reasons
213
207
  def list_invalid_properties
214
208
  invalid_properties = Array.new
209
+ if @name.nil?
210
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
211
+ end
212
+
213
+ if @schedule.nil?
214
+ invalid_properties.push("invalid value for 'schedule', schedule cannot be nil.")
215
+ end
216
+
215
217
  return invalid_properties
216
218
  end
217
219
 
@@ -220,7 +222,6 @@ module Dkron
220
222
  def valid?
221
223
  return false if @name.nil?
222
224
  return false if @schedule.nil?
223
- return false if @command.nil?
224
225
  return true
225
226
  end
226
227
 
@@ -231,8 +232,7 @@ module Dkron
231
232
  self.class == o.class &&
232
233
  name == o.name &&
233
234
  schedule == o.schedule &&
234
- command == o.command &&
235
- shell == o.shell &&
235
+ timezone == o.timezone &&
236
236
  owner == o.owner &&
237
237
  owner_email == o.owner_email &&
238
238
  success_count == o.success_count &&
@@ -245,7 +245,9 @@ module Dkron
245
245
  parent_job == o.parent_job &&
246
246
  dependent_jobs == o.dependent_jobs &&
247
247
  processors == o.processors &&
248
- concurrency == o.concurrency
248
+ concurrency == o.concurrency &&
249
+ executor == o.executor &&
250
+ executor_config == o.executor_config
249
251
  end
250
252
 
251
253
  # @see the `==` method
@@ -257,7 +259,7 @@ module Dkron
257
259
  # Calculates hash code according to all attributes.
258
260
  # @return [Fixnum] Hash code
259
261
  def hash
260
- [name, schedule, command, shell, owner, owner_email, success_count, error_count, last_success, last_error, disabled, tags, retries, parent_job, dependent_jobs, processors, concurrency].hash
262
+ [name, schedule, timezone, owner, owner_email, success_count, error_count, last_success, last_error, disabled, tags, retries, parent_job, dependent_jobs, processors, concurrency, executor, executor_config].hash
261
263
  end
262
264
 
263
265
  # Builds the object from hash
@@ -266,7 +268,7 @@ module Dkron
266
268
  def build_from_hash(attributes)
267
269
  return nil unless attributes.is_a?(Hash)
268
270
  self.class.swagger_types.each_pair do |key, type|
269
- if type =~ /^Array<(.*)>/i
271
+ if type =~ /\AArray<(.*)>/i
270
272
  # check to ensure the input is an array given that the the attribute
271
273
  # is documented as an array but the input is not
272
274
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -297,7 +299,7 @@ module Dkron
297
299
  when :Float
298
300
  value.to_f
299
301
  when :BOOLEAN
300
- if value.to_s =~ /^(true|t|yes|y|1)$/i
302
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
301
303
  true
302
304
  else
303
305
  false
@@ -308,7 +310,7 @@ module Dkron
308
310
  when /\AArray<(?<inner_type>.+)>\z/
309
311
  inner_type = Regexp.last_match[:inner_type]
310
312
  value.map { |v| _deserialize(inner_type, v) }
311
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
313
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
312
314
  k_type = Regexp.last_match[:k_type]
313
315
  v_type = Regexp.last_match[:v_type]
314
316
  {}.tap do |hash|
@@ -3,21 +3,10 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -44,6 +33,7 @@ module Dkron
44
33
  # Serf protocol minimum version this node can understand or speak
45
34
  attr_accessor :protocol_min
46
35
 
36
+ # Serf protocol maximum version this node can understand or speak
47
37
  attr_accessor :protocol_max
48
38
 
49
39
  # Serf protocol current version this node can understand or speak
@@ -52,10 +42,10 @@ module Dkron
52
42
  # Serf delegate protocol minimum version this node can understand or speak
53
43
  attr_accessor :delegate_min
54
44
 
55
- # Serf delegate protocol minimum version this node can understand or speak
45
+ # Serf delegate protocol maximum version this node can understand or speak
56
46
  attr_accessor :delegate_max
57
47
 
58
- # Serf delegate protocol minimum version this node can understand or speak
48
+ # Serf delegate protocol current version this node can understand or speak
59
49
  attr_accessor :delegate_cur
60
50
 
61
51
 
@@ -114,7 +104,7 @@ module Dkron
114
104
  end
115
105
 
116
106
  if attributes.has_key?(:'Tags')
117
- if (value = attributes[:'Tags']).is_a?(Array)
107
+ if (value = attributes[:'Tags']).is_a?(Hash)
118
108
  self.tags = value
119
109
  end
120
110
  end
@@ -150,7 +140,7 @@ module Dkron
150
140
  end
151
141
 
152
142
  # Show invalid properties with the reasons. Usually used together with valid?
153
- # @return Array for valid properies with the reasons
143
+ # @return Array for valid properties with the reasons
154
144
  def list_invalid_properties
155
145
  invalid_properties = Array.new
156
146
  return invalid_properties
@@ -198,7 +188,7 @@ module Dkron
198
188
  def build_from_hash(attributes)
199
189
  return nil unless attributes.is_a?(Hash)
200
190
  self.class.swagger_types.each_pair do |key, type|
201
- if type =~ /^Array<(.*)>/i
191
+ if type =~ /\AArray<(.*)>/i
202
192
  # check to ensure the input is an array given that the the attribute
203
193
  # is documented as an array but the input is not
204
194
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -229,7 +219,7 @@ module Dkron
229
219
  when :Float
230
220
  value.to_f
231
221
  when :BOOLEAN
232
- if value.to_s =~ /^(true|t|yes|y|1)$/i
222
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
223
  true
234
224
  else
235
225
  false
@@ -240,7 +230,7 @@ module Dkron
240
230
  when /\AArray<(?<inner_type>.+)>\z/
241
231
  inner_type = Regexp.last_match[:inner_type]
242
232
  value.map { |v| _deserialize(inner_type, v) }
243
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
233
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
234
  k_type = Regexp.last_match[:k_type]
245
235
  v_type = Regexp.last_match[:v_type]
246
236
  {}.tap do |hash|
@@ -0,0 +1,198 @@
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.10.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Dkron
16
+ # Files processor save execution output to disk files.
17
+ class ProcessorFiles
18
+ # Forward the output to the next processor
19
+ attr_accessor :forward
20
+
21
+ attr_accessor :log_dir
22
+
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'forward' => :'forward',
28
+ :'log_dir' => :'log_dir'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'forward' => :'BOOLEAN',
36
+ :'log_dir' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
47
+
48
+ if attributes.has_key?(:'forward')
49
+ self.forward = attributes[:'forward']
50
+ end
51
+
52
+ if attributes.has_key?(:'log_dir')
53
+ self.log_dir = attributes[:'log_dir']
54
+ end
55
+
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properties with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ return invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ return true
69
+ end
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] Object to be compared
73
+ def ==(o)
74
+ return true if self.equal?(o)
75
+ self.class == o.class &&
76
+ forward == o.forward &&
77
+ log_dir == o.log_dir
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [forward, log_dir].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ self.class.swagger_types.each_pair do |key, type|
98
+ if type =~ /\AArray<(.*)>/i
99
+ # check to ensure the input is an array given that the the attribute
100
+ # is documented as an array but the input is not
101
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
102
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
103
+ end
104
+ elsif !attributes[self.class.attribute_map[key]].nil?
105
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
106
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
107
+ end
108
+
109
+ self
110
+ end
111
+
112
+ # Deserializes the data based on type
113
+ # @param string type Data type
114
+ # @param string value Value to be deserialized
115
+ # @return [Object] Deserialized data
116
+ def _deserialize(type, value)
117
+ case type.to_sym
118
+ when :DateTime
119
+ DateTime.parse(value)
120
+ when :Date
121
+ Date.parse(value)
122
+ when :String
123
+ value.to_s
124
+ when :Integer
125
+ value.to_i
126
+ when :Float
127
+ value.to_f
128
+ when :BOOLEAN
129
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
+ true
131
+ else
132
+ false
133
+ end
134
+ when :Object
135
+ # generic object (usually a Hash), return directly
136
+ value
137
+ when /\AArray<(?<inner_type>.+)>\z/
138
+ inner_type = Regexp.last_match[:inner_type]
139
+ value.map { |v| _deserialize(inner_type, v) }
140
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
141
+ k_type = Regexp.last_match[:k_type]
142
+ v_type = Regexp.last_match[:v_type]
143
+ {}.tap do |hash|
144
+ value.each do |k, v|
145
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
+ end
147
+ end
148
+ else # model
149
+ temp_model = Dkron.const_get(type).new
150
+ temp_model.build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ # Returns the string representation of the object
155
+ # @return [String] String presentation of the object
156
+ def to_s
157
+ to_hash.to_s
158
+ end
159
+
160
+ # to_body is an alias to to_hash (backward compatibility)
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ # Returns the object in the form of hash
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_hash
169
+ hash = {}
170
+ self.class.attribute_map.each_pair do |attr, param|
171
+ value = self.send(attr)
172
+ next if value.nil?
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map{ |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+
196
+ end
197
+
198
+ end