dkron-ruby 1.0.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 (44) hide show
  1. checksums.yaml +7 -0
  2. data/DEVELOP.md +596 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +69 -0
  5. data/README.md +99 -0
  6. data/Rakefile +8 -0
  7. data/dkron-ruby.gemspec +45 -0
  8. data/docs/DefaultApi.md +131 -0
  9. data/docs/Execution.md +13 -0
  10. data/docs/ExecutionsApi.md +55 -0
  11. data/docs/Job.md +28 -0
  12. data/docs/JobsApi.md +295 -0
  13. data/docs/Member.md +18 -0
  14. data/docs/MembersApi.md +49 -0
  15. data/docs/Processors.md +7 -0
  16. data/docs/Status.md +10 -0
  17. data/git_push.sh +55 -0
  18. data/lib/dkron-ruby.rb +48 -0
  19. data/lib/dkron-ruby/api/default_api.rb +161 -0
  20. data/lib/dkron-ruby/api/executions_api.rb +75 -0
  21. data/lib/dkron-ruby/api/jobs_api.rb +335 -0
  22. data/lib/dkron-ruby/api/members_api.rb +69 -0
  23. data/lib/dkron-ruby/api_client.rb +390 -0
  24. data/lib/dkron-ruby/api_error.rb +38 -0
  25. data/lib/dkron-ruby/configuration.rb +202 -0
  26. data/lib/dkron-ruby/models/execution.rb +236 -0
  27. data/lib/dkron-ruby/models/job.rb +403 -0
  28. data/lib/dkron-ruby/models/member.rb +288 -0
  29. data/lib/dkron-ruby/models/processors.rb +176 -0
  30. data/lib/dkron-ruby/models/status.rb +206 -0
  31. data/lib/dkron-ruby/version.rb +15 -0
  32. data/spec/api/default_api_spec.rb +65 -0
  33. data/spec/api/executions_api_spec.rb +46 -0
  34. data/spec/api/jobs_api_spec.rb +102 -0
  35. data/spec/api/members_api_spec.rb +45 -0
  36. data/spec/api_client_spec.rb +243 -0
  37. data/spec/configuration_spec.rb +42 -0
  38. data/spec/models/execution_spec.rb +71 -0
  39. data/spec/models/job_spec.rb +161 -0
  40. data/spec/models/member_spec.rb +101 -0
  41. data/spec/models/processors_spec.rb +35 -0
  42. data/spec/models/status_spec.rb +53 -0
  43. data/spec/spec_helper.rb +111 -0
  44. metadata +283 -0
data/docs/JobsApi.md ADDED
@@ -0,0 +1,295 @@
1
+ # Dkron::JobsApi
2
+
3
+ All URIs are relative to *http://localhost:8080/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**create_or_update_job**](JobsApi.md#create_or_update_job) | **POST** /jobs |
8
+ [**delete_job**](JobsApi.md#delete_job) | **DELETE** /jobs/{job_name} |
9
+ [**get_jobs**](JobsApi.md#get_jobs) | **GET** /jobs |
10
+ [**run_job**](JobsApi.md#run_job) | **POST** /jobs/{job_name} |
11
+ [**show_job_by_name**](JobsApi.md#show_job_by_name) | **GET** /jobs/{job_name} |
12
+ [**toggle_job**](JobsApi.md#toggle_job) | **POST** /jobs/{job_name}/toggle |
13
+
14
+
15
+ # **create_or_update_job**
16
+ > Job create_or_update_job(body, opts)
17
+
18
+
19
+
20
+ Create or updates a new job.
21
+
22
+ ### Example
23
+ ```ruby
24
+ # load the gem
25
+ require 'dkron-ruby'
26
+
27
+ api_instance = Dkron::JobsApi.new
28
+
29
+ body = Dkron::Job.new # Job | Updated job object
30
+
31
+ opts = {
32
+ runoncreate: nil # Object | If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated.
33
+ }
34
+
35
+ begin
36
+ result = api_instance.create_or_update_job(body, opts)
37
+ p result
38
+ rescue Dkron::ApiError => e
39
+ puts "Exception when calling JobsApi->create_or_update_job: #{e}"
40
+ end
41
+ ```
42
+
43
+ ### Parameters
44
+
45
+ Name | Type | Description | Notes
46
+ ------------- | ------------- | ------------- | -------------
47
+ **body** | [**Job**](Job.md)| Updated job object |
48
+ **runoncreate** | [**Object**](.md)| If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated. | [optional]
49
+
50
+ ### Return type
51
+
52
+ [**Job**](Job.md)
53
+
54
+ ### Authorization
55
+
56
+ No authorization required
57
+
58
+ ### HTTP request headers
59
+
60
+ - **Content-Type**: application/json
61
+ - **Accept**: application/json
62
+
63
+
64
+
65
+ # **delete_job**
66
+ > Job delete_job(job_name)
67
+
68
+
69
+
70
+ Delete a job.
71
+
72
+ ### Example
73
+ ```ruby
74
+ # load the gem
75
+ require 'dkron-ruby'
76
+
77
+ api_instance = Dkron::JobsApi.new
78
+
79
+ job_name = 'job_name_example' # String | The job that needs to be deleted.
80
+
81
+
82
+ begin
83
+ result = api_instance.delete_job(job_name)
84
+ p result
85
+ rescue Dkron::ApiError => e
86
+ puts "Exception when calling JobsApi->delete_job: #{e}"
87
+ end
88
+ ```
89
+
90
+ ### Parameters
91
+
92
+ Name | Type | Description | Notes
93
+ ------------- | ------------- | ------------- | -------------
94
+ **job_name** | **String**| The job that needs to be deleted. |
95
+
96
+ ### Return type
97
+
98
+ [**Job**](Job.md)
99
+
100
+ ### Authorization
101
+
102
+ No authorization required
103
+
104
+ ### HTTP request headers
105
+
106
+ - **Content-Type**: application/json
107
+ - **Accept**: application/json
108
+
109
+
110
+
111
+ # **get_jobs**
112
+ > Array<Job> get_jobs(opts)
113
+
114
+
115
+
116
+ List jobs.
117
+
118
+ ### Example
119
+ ```ruby
120
+ # load the gem
121
+ require 'dkron-ruby'
122
+
123
+ api_instance = Dkron::JobsApi.new
124
+
125
+ opts = {
126
+ metadata: ['metadata_example'] # Array<String> | Filter jobs by metadata
127
+ }
128
+
129
+ begin
130
+ result = api_instance.get_jobs(opts)
131
+ p result
132
+ rescue Dkron::ApiError => e
133
+ puts "Exception when calling JobsApi->get_jobs: #{e}"
134
+ end
135
+ ```
136
+
137
+ ### Parameters
138
+
139
+ Name | Type | Description | Notes
140
+ ------------- | ------------- | ------------- | -------------
141
+ **metadata** | [**Array&lt;String&gt;**](String.md)| Filter jobs by metadata | [optional]
142
+
143
+ ### Return type
144
+
145
+ [**Array&lt;Job&gt;**](Job.md)
146
+
147
+ ### Authorization
148
+
149
+ No authorization required
150
+
151
+ ### HTTP request headers
152
+
153
+ - **Content-Type**: application/json
154
+ - **Accept**: application/json
155
+
156
+
157
+
158
+ # **run_job**
159
+ > Job run_job(job_name)
160
+
161
+
162
+
163
+ Executes a job.
164
+
165
+ ### Example
166
+ ```ruby
167
+ # load the gem
168
+ require 'dkron-ruby'
169
+
170
+ api_instance = Dkron::JobsApi.new
171
+
172
+ job_name = 'job_name_example' # String | The job that needs to be run.
173
+
174
+
175
+ begin
176
+ result = api_instance.run_job(job_name)
177
+ p result
178
+ rescue Dkron::ApiError => e
179
+ puts "Exception when calling JobsApi->run_job: #{e}"
180
+ end
181
+ ```
182
+
183
+ ### Parameters
184
+
185
+ Name | Type | Description | Notes
186
+ ------------- | ------------- | ------------- | -------------
187
+ **job_name** | **String**| The job that needs to be run. |
188
+
189
+ ### Return type
190
+
191
+ [**Job**](Job.md)
192
+
193
+ ### Authorization
194
+
195
+ No authorization required
196
+
197
+ ### HTTP request headers
198
+
199
+ - **Content-Type**: application/json
200
+ - **Accept**: application/json
201
+
202
+
203
+
204
+ # **show_job_by_name**
205
+ > Job show_job_by_name(job_name)
206
+
207
+
208
+
209
+ Show a job.
210
+
211
+ ### Example
212
+ ```ruby
213
+ # load the gem
214
+ require 'dkron-ruby'
215
+
216
+ api_instance = Dkron::JobsApi.new
217
+
218
+ job_name = 'job_name_example' # String | The job that needs to be fetched.
219
+
220
+
221
+ begin
222
+ result = api_instance.show_job_by_name(job_name)
223
+ p result
224
+ rescue Dkron::ApiError => e
225
+ puts "Exception when calling JobsApi->show_job_by_name: #{e}"
226
+ end
227
+ ```
228
+
229
+ ### Parameters
230
+
231
+ Name | Type | Description | Notes
232
+ ------------- | ------------- | ------------- | -------------
233
+ **job_name** | **String**| The job that needs to be fetched. |
234
+
235
+ ### Return type
236
+
237
+ [**Job**](Job.md)
238
+
239
+ ### Authorization
240
+
241
+ No authorization required
242
+
243
+ ### HTTP request headers
244
+
245
+ - **Content-Type**: application/json
246
+ - **Accept**: application/json
247
+
248
+
249
+
250
+ # **toggle_job**
251
+ > Job toggle_job(job_name)
252
+
253
+
254
+
255
+ Toggle a job.
256
+
257
+ ### Example
258
+ ```ruby
259
+ # load the gem
260
+ require 'dkron-ruby'
261
+
262
+ api_instance = Dkron::JobsApi.new
263
+
264
+ job_name = 'job_name_example' # String | The job that needs to be toggled.
265
+
266
+
267
+ begin
268
+ result = api_instance.toggle_job(job_name)
269
+ p result
270
+ rescue Dkron::ApiError => e
271
+ puts "Exception when calling JobsApi->toggle_job: #{e}"
272
+ end
273
+ ```
274
+
275
+ ### Parameters
276
+
277
+ Name | Type | Description | Notes
278
+ ------------- | ------------- | ------------- | -------------
279
+ **job_name** | **String**| The job that needs to be toggled. |
280
+
281
+ ### Return type
282
+
283
+ [**Job**](Job.md)
284
+
285
+ ### Authorization
286
+
287
+ No authorization required
288
+
289
+ ### HTTP request headers
290
+
291
+ - **Content-Type**: application/json
292
+ - **Accept**: application/json
293
+
294
+
295
+
data/docs/Member.md ADDED
@@ -0,0 +1,18 @@
1
+ # Dkron::Member
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **name** | **String** | Node name | [optional]
7
+ **addr** | **String** | IP Address | [optional]
8
+ **port** | **Integer** | Port number | [optional]
9
+ **tags** | **Hash&lt;String, String&gt;** | Tags asociated with this node | [optional]
10
+ **status** | **Integer** | The serf status of the node see: https://godoc.org/github.com/hashicorp/serf/serf#MemberStatus | [optional]
11
+ **protocol_min** | **Integer** | Serf protocol minimum version this node can understand or speak | [optional]
12
+ **protocol_max** | **Integer** | Serf protocol maximum version this node can understand or speak | [optional]
13
+ **protocol_cur** | **Integer** | Serf protocol current version this node can understand or speak | [optional]
14
+ **delegate_min** | **Integer** | Serf delegate protocol minimum version this node can understand or speak | [optional]
15
+ **delegate_max** | **Integer** | Serf delegate protocol maximum version this node can understand or speak | [optional]
16
+ **delegate_cur** | **Integer** | Serf delegate protocol current version this node can understand or speak | [optional]
17
+
18
+
@@ -0,0 +1,49 @@
1
+ # Dkron::MembersApi
2
+
3
+ All URIs are relative to *http://localhost:8080/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**get_member**](MembersApi.md#get_member) | **GET** /members |
8
+
9
+
10
+ # **get_member**
11
+ > Array&lt;Member&gt; get_member
12
+
13
+
14
+
15
+ List members.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'dkron-ruby'
21
+
22
+ api_instance = Dkron::MembersApi.new
23
+
24
+ begin
25
+ result = api_instance.get_member
26
+ p result
27
+ rescue Dkron::ApiError => e
28
+ puts "Exception when calling MembersApi->get_member: #{e}"
29
+ end
30
+ ```
31
+
32
+ ### Parameters
33
+ This endpoint does not need any parameter.
34
+
35
+ ### Return type
36
+
37
+ [**Array&lt;Member&gt;**](Member.md)
38
+
39
+ ### Authorization
40
+
41
+ No authorization required
42
+
43
+ ### HTTP request headers
44
+
45
+ - **Content-Type**: application/json
46
+ - **Accept**: application/json
47
+
48
+
49
+
@@ -0,0 +1,7 @@
1
+ # Dkron::Processors
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+
7
+
data/docs/Status.md ADDED
@@ -0,0 +1,10 @@
1
+ # Dkron::Status
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **agent** | **Object** | Node basic details | [optional]
7
+ **serf** | **Object** | Serf status | [optional]
8
+ **tags** | **Object** | Tags asociated with this node | [optional]
9
+
10
+
data/git_push.sh ADDED
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
+ #
7
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
8
+
9
+ git_user_id=$1
10
+ git_repo_id=$2
11
+ release_note=$3
12
+
13
+ if [ "$git_user_id" = "" ]; then
14
+ git_user_id=""
15
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
+ fi
17
+
18
+ if [ "$git_repo_id" = "" ]; then
19
+ git_repo_id=""
20
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
+ fi
22
+
23
+ if [ "$release_note" = "" ]; then
24
+ release_note=""
25
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
+ fi
27
+
28
+ # Initialize the local directory as a Git repository
29
+ git init
30
+
31
+ # Adds the files in the local repository and stages them for commit.
32
+ git add .
33
+
34
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
+ git commit -m "$release_note"
36
+
37
+ # Sets the new remote
38
+ git_remote=`git remote`
39
+ if [ "$git_remote" = "" ]; then # git remote not defined
40
+
41
+ if [ "$GIT_TOKEN" = "" ]; then
42
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
+ else
45
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
+ fi
47
+
48
+ fi
49
+
50
+ git pull origin master
51
+
52
+ # Pushes (Forces) the changes in the local repository up to the remote repository
53
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
+ git push origin master 2>&1 | grep -v 'To https'
55
+
data/lib/dkron-ruby.rb ADDED
@@ -0,0 +1,48 @@
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: 2.2
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.13
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'dkron-ruby/api_client'
15
+ require 'dkron-ruby/api_error'
16
+ require 'dkron-ruby/version'
17
+ require 'dkron-ruby/configuration'
18
+
19
+ # Models
20
+ require 'dkron-ruby/models/execution'
21
+ require 'dkron-ruby/models/job'
22
+ require 'dkron-ruby/models/member'
23
+ require 'dkron-ruby/models/processors'
24
+ require 'dkron-ruby/models/status'
25
+
26
+ # APIs
27
+ require 'dkron-ruby/api/default_api'
28
+ require 'dkron-ruby/api/executions_api'
29
+ require 'dkron-ruby/api/jobs_api'
30
+ require 'dkron-ruby/api/members_api'
31
+
32
+ module Dkron
33
+ class << self
34
+ # Customize default settings for the SDK using block.
35
+ # Dkron.configure do |config|
36
+ # config.username = "xxx"
37
+ # config.password = "xxx"
38
+ # end
39
+ # If no block given, return the default Configuration object.
40
+ def configure
41
+ if block_given?
42
+ yield(Configuration.default)
43
+ else
44
+ Configuration.default
45
+ end
46
+ end
47
+ end
48
+ end