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,301 @@
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 'date'
25
+
26
+ module Dkron
27
+ # A member represents a cluster member node.
28
+ class Member
29
+ # Node name
30
+ attr_accessor :name
31
+
32
+ # IP Address
33
+ attr_accessor :addr
34
+
35
+ # Port number
36
+ attr_accessor :port
37
+
38
+ # Tags asociated with this node
39
+ attr_accessor :tags
40
+
41
+ # The serf status of the node see: https://godoc.org/github.com/hashicorp/serf/serf#MemberStatus
42
+ attr_accessor :status
43
+
44
+ # Serf protocol minimum version this node can understand or speak
45
+ attr_accessor :protocol_min
46
+
47
+ attr_accessor :protocol_max
48
+
49
+ # Serf protocol current version this node can understand or speak
50
+ attr_accessor :protocol_cur
51
+
52
+ # Serf delegate protocol minimum version this node can understand or speak
53
+ attr_accessor :delegate_min
54
+
55
+ # Serf delegate protocol minimum version this node can understand or speak
56
+ attr_accessor :delegate_max
57
+
58
+ # Serf delegate protocol minimum version this node can understand or speak
59
+ attr_accessor :delegate_cur
60
+
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'name' => :'Name',
66
+ :'addr' => :'Addr',
67
+ :'port' => :'Port',
68
+ :'tags' => :'Tags',
69
+ :'status' => :'Status',
70
+ :'protocol_min' => :'ProtocolMin',
71
+ :'protocol_max' => :'ProtocolMax',
72
+ :'protocol_cur' => :'ProtocolCur',
73
+ :'delegate_min' => :'DelegateMin',
74
+ :'delegate_max' => :'DelegateMax',
75
+ :'delegate_cur' => :'DelegateCur'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.swagger_types
81
+ {
82
+ :'name' => :'String',
83
+ :'addr' => :'String',
84
+ :'port' => :'Integer',
85
+ :'tags' => :'Hash<String, String>',
86
+ :'status' => :'Integer',
87
+ :'protocol_min' => :'Integer',
88
+ :'protocol_max' => :'Integer',
89
+ :'protocol_cur' => :'Integer',
90
+ :'delegate_min' => :'Integer',
91
+ :'delegate_max' => :'Integer',
92
+ :'delegate_cur' => :'Integer'
93
+ }
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ return unless attributes.is_a?(Hash)
100
+
101
+ # convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
103
+
104
+ if attributes.has_key?(:'Name')
105
+ self.name = attributes[:'Name']
106
+ end
107
+
108
+ if attributes.has_key?(:'Addr')
109
+ self.addr = attributes[:'Addr']
110
+ end
111
+
112
+ if attributes.has_key?(:'Port')
113
+ self.port = attributes[:'Port']
114
+ end
115
+
116
+ if attributes.has_key?(:'Tags')
117
+ if (value = attributes[:'Tags']).is_a?(Array)
118
+ self.tags = value
119
+ end
120
+ end
121
+
122
+ if attributes.has_key?(:'Status')
123
+ self.status = attributes[:'Status']
124
+ end
125
+
126
+ if attributes.has_key?(:'ProtocolMin')
127
+ self.protocol_min = attributes[:'ProtocolMin']
128
+ end
129
+
130
+ if attributes.has_key?(:'ProtocolMax')
131
+ self.protocol_max = attributes[:'ProtocolMax']
132
+ end
133
+
134
+ if attributes.has_key?(:'ProtocolCur')
135
+ self.protocol_cur = attributes[:'ProtocolCur']
136
+ end
137
+
138
+ if attributes.has_key?(:'DelegateMin')
139
+ self.delegate_min = attributes[:'DelegateMin']
140
+ end
141
+
142
+ if attributes.has_key?(:'DelegateMax')
143
+ self.delegate_max = attributes[:'DelegateMax']
144
+ end
145
+
146
+ if attributes.has_key?(:'DelegateCur')
147
+ self.delegate_cur = attributes[:'DelegateCur']
148
+ end
149
+
150
+ end
151
+
152
+ # Show invalid properties with the reasons. Usually used together with valid?
153
+ # @return Array for valid properies with the reasons
154
+ def list_invalid_properties
155
+ invalid_properties = Array.new
156
+ return invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ return true
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ name == o.name &&
171
+ addr == o.addr &&
172
+ port == o.port &&
173
+ tags == o.tags &&
174
+ status == o.status &&
175
+ protocol_min == o.protocol_min &&
176
+ protocol_max == o.protocol_max &&
177
+ protocol_cur == o.protocol_cur &&
178
+ delegate_min == o.delegate_min &&
179
+ delegate_max == o.delegate_max &&
180
+ delegate_cur == o.delegate_cur
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Fixnum] Hash code
191
+ def hash
192
+ [name, addr, port, tags, status, protocol_min, protocol_max, protocol_cur, delegate_min, delegate_max, delegate_cur].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ self.class.swagger_types.each_pair do |key, type|
201
+ if type =~ /^Array<(.*)>/i
202
+ # check to ensure the input is an array given that the the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
205
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
206
+ end
207
+ elsif !attributes[self.class.attribute_map[key]].nil?
208
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :DateTime
222
+ DateTime.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :BOOLEAN
232
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ temp_model = Dkron.const_get(type).new
253
+ temp_model.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ next if value.nil?
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map{ |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+
299
+ end
300
+
301
+ end
@@ -0,0 +1,152 @@
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`.\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
5
+
6
+ OpenAPI spec version: 0.7.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Dkron
16
+ # Serf status
17
+ class Serf
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+
29
+ }
30
+ end
31
+
32
+ def initialize(attributes = {})
33
+ return unless attributes.is_a?(Hash)
34
+
35
+ # convert string to symbol for hash key
36
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
37
+
38
+
39
+ end
40
+
41
+ # Check equality by comparing each attribute.
42
+ def ==(o)
43
+ return true if self.equal?(o)
44
+ self.class == o.class
45
+ end
46
+
47
+ # @see the `==` method
48
+ def eql?(o)
49
+ self == o
50
+ end
51
+
52
+ # Calculate hash code according to all attributes.
53
+ def hash
54
+ [].hash
55
+ end
56
+
57
+ # build the object from hash
58
+ def build_from_hash(attributes)
59
+ return nil unless attributes.is_a?(Hash)
60
+ self.class.swagger_types.each_pair do |key, type|
61
+ if type =~ /^Array<(.*)>/i
62
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
63
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
64
+ else
65
+ #TODO show warning in debug mode
66
+ end
67
+ elsif !attributes[self.class.attribute_map[key]].nil?
68
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
69
+ else
70
+ # data not found in attributes(hash), not an issue as the data can be optional
71
+ end
72
+ end
73
+
74
+ self
75
+ end
76
+
77
+ def _deserialize(type, value)
78
+ case type.to_sym
79
+ when :DateTime
80
+ DateTime.parse(value)
81
+ when :Date
82
+ Date.parse(value)
83
+ when :String
84
+ value.to_s
85
+ when :Integer
86
+ value.to_i
87
+ when :Float
88
+ value.to_f
89
+ when :BOOLEAN
90
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
91
+ true
92
+ else
93
+ false
94
+ end
95
+ when :Object
96
+ # generic object (usually a Hash), return directly
97
+ value
98
+ when /\AArray<(?<inner_type>.+)>\z/
99
+ inner_type = Regexp.last_match[:inner_type]
100
+ value.map { |v| _deserialize(inner_type, v) }
101
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
102
+ k_type = Regexp.last_match[:k_type]
103
+ v_type = Regexp.last_match[:v_type]
104
+ {}.tap do |hash|
105
+ value.each do |k, v|
106
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
107
+ end
108
+ end
109
+ else # model
110
+ _model = Dkron.const_get(type).new
111
+ _model.build_from_hash(value)
112
+ end
113
+ end
114
+
115
+ def to_s
116
+ to_hash.to_s
117
+ end
118
+
119
+ # to_body is an alias to to_body (backward compatibility))
120
+ def to_body
121
+ to_hash
122
+ end
123
+
124
+ # return the object in the form of hash
125
+ def to_hash
126
+ hash = {}
127
+ self.class.attribute_map.each_pair do |attr, param|
128
+ value = self.send(attr)
129
+ next if value.nil?
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+
135
+ # Method to output non-array value in the form of hash
136
+ # For object, use to_hash. Otherwise, just return the value
137
+ def _to_hash(value)
138
+ if value.is_a?(Array)
139
+ value.compact.map{ |v| _to_hash(v) }
140
+ elsif value.is_a?(Hash)
141
+ {}.tap do |hash|
142
+ value.each { |k, v| hash[k] = _to_hash(v) }
143
+ end
144
+ elsif value.respond_to? :to_hash
145
+ value.to_hash
146
+ else
147
+ value
148
+ end
149
+ end
150
+
151
+ end
152
+ end