dkron-rb 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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
 
@@ -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
 
@@ -22,6 +22,7 @@ module Dkron
22
22
  # Create or updates a new job.
23
23
  # @param body Updated job object
24
24
  # @param [Hash] opts the optional parameters
25
+ # @option opts [BOOLEAN] :runoncreate If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.
25
26
  # @return [Job]
26
27
  def create_or_update_job(body, opts = {})
27
28
  data, _status_code, _headers = create_or_update_job_with_http_info(body, opts)
@@ -31,6 +32,7 @@ module Dkron
31
32
  # Create or updates a new job.
32
33
  # @param body Updated job object
33
34
  # @param [Hash] opts the optional parameters
35
+ # @option opts [BOOLEAN] :runoncreate If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.
34
36
  # @return [Array<(Job, Fixnum, Hash)>] Job data, response status code and response headers
35
37
  def create_or_update_job_with_http_info(body, opts = {})
36
38
  if @api_client.config.debugging
@@ -45,6 +47,7 @@ module Dkron
45
47
 
46
48
  # query parameters
47
49
  query_params = {}
50
+ query_params[:'runoncreate'] = opts[:'runoncreate'] if !opts[:'runoncreate'].nil?
48
51
 
49
52
  # header parameters
50
53
  header_params = {}
@@ -125,7 +128,12 @@ module Dkron
125
128
  end
126
129
  # List jobs.
127
130
  # @param [Hash] opts the optional parameters
128
- # @option opts [Array<String>] :tags Filter jobs by tags
131
+ # @option opts [Array<String>] :metadata Filter jobs by metadata
132
+ # @option opts [String] :_sort Sorting field
133
+ # @option opts [String] :_order Sort order (ASC/DESC)
134
+ # @option opts [String] :q Filter query text
135
+ # @option opts [Integer] :_start Start index
136
+ # @option opts [Integer] :_end End index
129
137
  # @return [Array<Job>]
130
138
  def get_jobs(opts = {})
131
139
  data, _status_code, _headers = get_jobs_with_http_info(opts)
@@ -134,7 +142,12 @@ module Dkron
134
142
 
135
143
  # List jobs.
136
144
  # @param [Hash] opts the optional parameters
137
- # @option opts [Array<String>] :tags Filter jobs by tags
145
+ # @option opts [Array<String>] :metadata Filter jobs by metadata
146
+ # @option opts [String] :_sort Sorting field
147
+ # @option opts [String] :_order Sort order (ASC/DESC)
148
+ # @option opts [String] :q Filter query text
149
+ # @option opts [Integer] :_start Start index
150
+ # @option opts [Integer] :_end End index
138
151
  # @return [Array<(Array<Job>, Fixnum, Hash)>] Array<Job> data, response status code and response headers
139
152
  def get_jobs_with_http_info(opts = {})
140
153
  if @api_client.config.debugging
@@ -145,7 +158,12 @@ module Dkron
145
158
 
146
159
  # query parameters
147
160
  query_params = {}
148
- query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?
161
+ query_params[:'metadata'] = @api_client.build_collection_param(opts[:'metadata'], :multi) if !opts[:'metadata'].nil?
162
+ query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
163
+ query_params[:'_order'] = opts[:'_order'] if !opts[:'_order'].nil?
164
+ query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
165
+ query_params[:'_start'] = opts[:'_start'] if !opts[:'_start'].nil?
166
+ query_params[:'_end'] = opts[:'_end'] if !opts[:'_end'].nil?
149
167
 
150
168
  # header parameters
151
169
  header_params = {}
@@ -172,6 +190,59 @@ module Dkron
172
190
  end
173
191
  return data, status_code, headers
174
192
  end
193
+ # Restore jobs from json file.
194
+ # @param file Json file that needs to be restored.
195
+ # @param [Hash] opts the optional parameters
196
+ # @return [Array<Restore>]
197
+ def restore(file, opts = {})
198
+ data, _status_code, _headers = restore_with_http_info(file, opts)
199
+ data
200
+ end
201
+
202
+ # Restore jobs from json file.
203
+ # @param file Json file that needs to be restored.
204
+ # @param [Hash] opts the optional parameters
205
+ # @return [Array<(Array<Restore>, Fixnum, Hash)>] Array<Restore> data, response status code and response headers
206
+ def restore_with_http_info(file, opts = {})
207
+ if @api_client.config.debugging
208
+ @api_client.config.logger.debug 'Calling API: JobsApi.restore ...'
209
+ end
210
+ # verify the required parameter 'file' is set
211
+ if @api_client.config.client_side_validation && file.nil?
212
+ fail ArgumentError, "Missing the required parameter 'file' when calling JobsApi.restore"
213
+ end
214
+ # resource path
215
+ local_var_path = '/restore'
216
+
217
+ # query parameters
218
+ query_params = {}
219
+
220
+ # header parameters
221
+ header_params = {}
222
+ # HTTP header 'Accept' (if needed)
223
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
224
+ # HTTP header 'Content-Type'
225
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
226
+
227
+ # form parameters
228
+ form_params = {}
229
+ form_params['file'] = file
230
+
231
+ # http body (model)
232
+ post_body = nil
233
+ auth_names = []
234
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
235
+ :header_params => header_params,
236
+ :query_params => query_params,
237
+ :form_params => form_params,
238
+ :body => post_body,
239
+ :auth_names => auth_names,
240
+ :return_type => 'Array<Restore>')
241
+ if @api_client.config.debugging
242
+ @api_client.config.logger.debug "API called: JobsApi#restore\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
243
+ end
244
+ return data, status_code, headers
245
+ end
175
246
  # Executes a job.
176
247
  # @param job_name The job that needs to be run.
177
248
  # @param [Hash] opts the optional parameters
@@ -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
 
@@ -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
 
@@ -15,7 +15,7 @@ require 'json'
15
15
  require 'logger'
16
16
  require 'tempfile'
17
17
  require 'typhoeus'
18
- require 'uri'
18
+ require 'addressable/uri'
19
19
 
20
20
  module Dkron
21
21
  class ApiClient
@@ -63,7 +63,7 @@ module Dkron
63
63
  :message => response.return_message)
64
64
  else
65
65
  fail ApiError.new(:code => response.code,
66
- :response_headers => response.headers,
66
+ :response_headers => response.headers.to_h,
67
67
  :response_body => response.body),
68
68
  response.status_message
69
69
  end
@@ -111,6 +111,8 @@ module Dkron
111
111
  :verbose => @config.debugging
112
112
  }
113
113
 
114
+ req_opts.merge!(multipart: true) if header_params['Content-Type'].start_with? "multipart/"
115
+
114
116
  # set custom cert, if provided
115
117
  req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
116
118
 
@@ -263,7 +265,7 @@ module Dkron
263
265
  def build_request_url(path)
264
266
  # Add leading and trailing slashes to path
265
267
  path = "/#{path}".gsub(/\/+/, '/')
266
- URI.encode(@config.base_url + path)
268
+ Addressable::URI.encode(@config.base_url + path)
267
269
  end
268
270
 
269
271
  # Builds the HTTP request body
@@ -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
 
@@ -6,11 +6,11 @@
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
 
13
- require 'uri'
13
+ require 'addressable/uri'
14
14
 
15
15
  module Dkron
16
16
  class Configuration
@@ -175,7 +175,7 @@ module Dkron
175
175
 
176
176
  def base_url
177
177
  url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178
- URI.encode(url)
178
+ Addressable::URI.encode(url)
179
179
  end
180
180
 
181
181
  # Gets API key (with prefix if set).
@@ -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
 
@@ -135,7 +135,7 @@ module Dkron
135
135
  return nil unless attributes.is_a?(Hash)
136
136
  self.class.swagger_types.each_pair do |key, type|
137
137
  if type =~ /\AArray<(.*)>/i
138
- # check to ensure the input is an array given that the the attribute
138
+ # check to ensure the input is an array given that the attribute
139
139
  # is documented as an array but the input is not
140
140
  if attributes[self.class.attribute_map[key]].is_a?(Array)
141
141
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -231,5 +231,6 @@ module Dkron
231
231
  value
232
232
  end
233
233
  end
234
+
234
235
  end
235
236
  end
@@ -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
 
@@ -15,9 +15,12 @@ require 'date'
15
15
  module Dkron
16
16
  # A Job represents a scheduled task to execute.
17
17
  class Job
18
- # Name for the job.
18
+ # Name for the job. Use only lower case letters (unicode), digits, underscore and dash.
19
19
  attr_accessor :name
20
20
 
21
+ # Nice name for the job. Optional.
22
+ attr_accessor :displayname
23
+
21
24
  # Cron expression for the job.
22
25
  attr_accessor :schedule
23
26
 
@@ -48,6 +51,9 @@ module Dkron
48
51
  # Target nodes tags of this job
49
52
  attr_accessor :tags
50
53
 
54
+ # Extra metadata tags for this job
55
+ attr_accessor :metadata
56
+
51
57
  # Number of times to retry a failed job execution
52
58
  attr_accessor :retries
53
59
 
@@ -65,12 +71,17 @@ module Dkron
65
71
  # Executor plugin used to run the job
66
72
  attr_accessor :executor
67
73
 
74
+ # Executor plugin parameters
68
75
  attr_accessor :executor_config
69
76
 
77
+ # Status of the job
78
+ attr_accessor :status
79
+
70
80
  # Attribute mapping from ruby-style variable name to JSON key.
71
81
  def self.attribute_map
72
82
  {
73
83
  :'name' => :'name',
84
+ :'displayname' => :'displayname',
74
85
  :'schedule' => :'schedule',
75
86
  :'timezone' => :'timezone',
76
87
  :'owner' => :'owner',
@@ -81,13 +92,15 @@ module Dkron
81
92
  :'last_error' => :'last_error',
82
93
  :'disabled' => :'disabled',
83
94
  :'tags' => :'tags',
95
+ :'metadata' => :'metadata',
84
96
  :'retries' => :'retries',
85
97
  :'parent_job' => :'parent_job',
86
98
  :'dependent_jobs' => :'dependent_jobs',
87
99
  :'processors' => :'processors',
88
100
  :'concurrency' => :'concurrency',
89
101
  :'executor' => :'executor',
90
- :'executor_config' => :'executor_config'
102
+ :'executor_config' => :'executor_config',
103
+ :'status' => :'status'
91
104
  }
92
105
  end
93
106
 
@@ -95,6 +108,7 @@ module Dkron
95
108
  def self.swagger_types
96
109
  {
97
110
  :'name' => :'String',
111
+ :'displayname' => :'String',
98
112
  :'schedule' => :'String',
99
113
  :'timezone' => :'String',
100
114
  :'owner' => :'String',
@@ -105,13 +119,15 @@ module Dkron
105
119
  :'last_error' => :'DateTime',
106
120
  :'disabled' => :'BOOLEAN',
107
121
  :'tags' => :'Hash<String, String>',
122
+ :'metadata' => :'Hash<String, String>',
108
123
  :'retries' => :'Integer',
109
124
  :'parent_job' => :'String',
110
125
  :'dependent_jobs' => :'Array<String>',
111
126
  :'processors' => :'Processors',
112
127
  :'concurrency' => :'String',
113
128
  :'executor' => :'String',
114
- :'executor_config' => :'ExecutorConfig'
129
+ :'executor_config' => :'Hash<String, String>',
130
+ :'status' => :'String'
115
131
  }
116
132
  end
117
133
 
@@ -127,6 +143,10 @@ module Dkron
127
143
  self.name = attributes[:'name']
128
144
  end
129
145
 
146
+ if attributes.has_key?(:'displayname')
147
+ self.displayname = attributes[:'displayname']
148
+ end
149
+
130
150
  if attributes.has_key?(:'schedule')
131
151
  self.schedule = attributes[:'schedule']
132
152
  end
@@ -169,6 +189,12 @@ module Dkron
169
189
  end
170
190
  end
171
191
 
192
+ if attributes.has_key?(:'metadata')
193
+ if (value = attributes[:'metadata']).is_a?(Hash)
194
+ self.metadata = value
195
+ end
196
+ end
197
+
172
198
  if attributes.has_key?(:'retries')
173
199
  self.retries = attributes[:'retries']
174
200
  end
@@ -196,7 +222,13 @@ module Dkron
196
222
  end
197
223
 
198
224
  if attributes.has_key?(:'executor_config')
199
- self.executor_config = attributes[:'executor_config']
225
+ if (value = attributes[:'executor_config']).is_a?(Hash)
226
+ self.executor_config = value
227
+ end
228
+ end
229
+
230
+ if attributes.has_key?(:'status')
231
+ self.status = attributes[:'status']
200
232
  end
201
233
  end
202
234
 
@@ -229,6 +261,7 @@ module Dkron
229
261
  return true if self.equal?(o)
230
262
  self.class == o.class &&
231
263
  name == o.name &&
264
+ displayname == o.displayname &&
232
265
  schedule == o.schedule &&
233
266
  timezone == o.timezone &&
234
267
  owner == o.owner &&
@@ -239,13 +272,15 @@ module Dkron
239
272
  last_error == o.last_error &&
240
273
  disabled == o.disabled &&
241
274
  tags == o.tags &&
275
+ metadata == o.metadata &&
242
276
  retries == o.retries &&
243
277
  parent_job == o.parent_job &&
244
278
  dependent_jobs == o.dependent_jobs &&
245
279
  processors == o.processors &&
246
280
  concurrency == o.concurrency &&
247
281
  executor == o.executor &&
248
- executor_config == o.executor_config
282
+ executor_config == o.executor_config &&
283
+ status == o.status
249
284
  end
250
285
 
251
286
  # @see the `==` method
@@ -257,7 +292,7 @@ module Dkron
257
292
  # Calculates hash code according to all attributes.
258
293
  # @return [Fixnum] Hash code
259
294
  def hash
260
- [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
295
+ [name, displayname, schedule, timezone, owner, owner_email, success_count, error_count, last_success, last_error, disabled, tags, metadata, retries, parent_job, dependent_jobs, processors, concurrency, executor, executor_config, status].hash
261
296
  end
262
297
 
263
298
  # Builds the object from hash
@@ -267,7 +302,7 @@ module Dkron
267
302
  return nil unless attributes.is_a?(Hash)
268
303
  self.class.swagger_types.each_pair do |key, type|
269
304
  if type =~ /\AArray<(.*)>/i
270
- # check to ensure the input is an array given that the the attribute
305
+ # check to ensure the input is an array given that the attribute
271
306
  # is documented as an array but the input is not
272
307
  if attributes[self.class.attribute_map[key]].is_a?(Array)
273
308
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -363,5 +398,6 @@ module Dkron
363
398
  value
364
399
  end
365
400
  end
401
+
366
402
  end
367
403
  end
@@ -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
 
@@ -187,7 +187,7 @@ module Dkron
187
187
  return nil unless attributes.is_a?(Hash)
188
188
  self.class.swagger_types.each_pair do |key, type|
189
189
  if type =~ /\AArray<(.*)>/i
190
- # check to ensure the input is an array given that the the attribute
190
+ # check to ensure the input is an array given that the attribute
191
191
  # is documented as an array but the input is not
192
192
  if attributes[self.class.attribute_map[key]].is_a?(Array)
193
193
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -283,5 +283,6 @@ module Dkron
283
283
  value
284
284
  end
285
285
  end
286
+
286
287
  end
287
288
  end