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
 
@@ -87,6 +76,11 @@ module Dkron
87
76
  # Default to 0 (never times out).
88
77
  attr_accessor :timeout
89
78
 
79
+ # Set this to false to skip client side validation in the operation.
80
+ # Default to true.
81
+ # @return [true, false]
82
+ attr_accessor :client_side_validation
83
+
90
84
  ### TLS/SSL setting
91
85
  # Set this to false to skip verifying SSL certificate when calling API from https server.
92
86
  # Default to true.
@@ -140,6 +134,7 @@ module Dkron
140
134
  @api_key = {}
141
135
  @api_key_prefix = {}
142
136
  @timeout = 0
137
+ @client_side_validation = true
143
138
  @verify_ssl = true
144
139
  @verify_ssl_host = true
145
140
  @params_encoding = nil
@@ -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
 
@@ -104,7 +93,7 @@ module Dkron
104
93
  end
105
94
 
106
95
  # Show invalid properties with the reasons. Usually used together with valid?
107
- # @return Array for valid properies with the reasons
96
+ # @return Array for valid properties with the reasons
108
97
  def list_invalid_properties
109
98
  invalid_properties = Array.new
110
99
  return invalid_properties
@@ -147,7 +136,7 @@ module Dkron
147
136
  def build_from_hash(attributes)
148
137
  return nil unless attributes.is_a?(Hash)
149
138
  self.class.swagger_types.each_pair do |key, type|
150
- if type =~ /^Array<(.*)>/i
139
+ if type =~ /\AArray<(.*)>/i
151
140
  # check to ensure the input is an array given that the the attribute
152
141
  # is documented as an array but the input is not
153
142
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -178,7 +167,7 @@ module Dkron
178
167
  when :Float
179
168
  value.to_f
180
169
  when :BOOLEAN
181
- if value.to_s =~ /^(true|t|yes|y|1)$/i
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
171
  true
183
172
  else
184
173
  false
@@ -189,7 +178,7 @@ module Dkron
189
178
  when /\AArray<(?<inner_type>.+)>\z/
190
179
  inner_type = Regexp.last_match[:inner_type]
191
180
  value.map { |v| _deserialize(inner_type, v) }
192
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
182
  k_type = Regexp.last_match[:k_type]
194
183
  v_type = Regexp.last_match[:v_type]
195
184
  {}.tap do |hash|
@@ -0,0 +1,179 @@
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
+ # Executor plugin parameters
17
+ class ExecutorConfig
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ }
29
+ end
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ return unless attributes.is_a?(Hash)
35
+
36
+ # convert string to symbol for hash key
37
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
+
39
+ end
40
+
41
+ # Show invalid properties with the reasons. Usually used together with valid?
42
+ # @return Array for valid properties with the reasons
43
+ def list_invalid_properties
44
+ invalid_properties = Array.new
45
+ return invalid_properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ return true
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] Object to be compared
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] Object to be compared
63
+ def eql?(o)
64
+ self == o
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Fixnum] Hash code
69
+ def hash
70
+ [].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ self.class.swagger_types.each_pair do |key, type|
79
+ if type =~ /\AArray<(.*)>/i
80
+ # check to ensure the input is an array given that the the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ end
85
+ elsif !attributes[self.class.attribute_map[key]].nil?
86
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+
90
+ self
91
+ end
92
+
93
+ # Deserializes the data based on type
94
+ # @param string type Data type
95
+ # @param string value Value to be deserialized
96
+ # @return [Object] Deserialized data
97
+ def _deserialize(type, value)
98
+ case type.to_sym
99
+ when :DateTime
100
+ DateTime.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :BOOLEAN
110
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when :Object
116
+ # generic object (usually a Hash), return directly
117
+ value
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ temp_model = Dkron.const_get(type).new
131
+ temp_model.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_hash (backward compatibility)
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_body
144
+ to_hash
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map{ |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ end
@@ -0,0 +1,208 @@
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
+ # Shell executor runs a command in shell
17
+ class ExecutorShell
18
+ # Command to run
19
+ attr_accessor :command
20
+
21
+ # Comma separated environment variables pair
22
+ attr_accessor :env
23
+
24
+ attr_accessor :shell
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'command' => :'command',
31
+ :'env' => :'env',
32
+ :'shell' => :'shell'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'command' => :'String',
40
+ :'env' => :'String',
41
+ :'shell' => :'BOOLEAN'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+
53
+ if attributes.has_key?(:'command')
54
+ self.command = attributes[:'command']
55
+ end
56
+
57
+ if attributes.has_key?(:'env')
58
+ self.env = attributes[:'env']
59
+ end
60
+
61
+ if attributes.has_key?(:'shell')
62
+ self.shell = attributes[:'shell']
63
+ end
64
+
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ return invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ command == o.command &&
86
+ env == o.env &&
87
+ shell == o.shell
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Fixnum] Hash code
98
+ def hash
99
+ [command, env, shell].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :BOOLEAN
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ temp_model = Dkron.const_get(type).new
160
+ temp_model.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map{ |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end