dkron-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 12.0.0'
7
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dkron-ruby (1.0.0)
5
+ json (~> 2.1, >= 2.1.0)
6
+ typhoeus (~> 1.0, >= 1.0.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ZenTest (4.12.0)
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
+ autotest (4.4.6)
15
+ ZenTest (>= 4.4.1)
16
+ autotest-fsevent (0.2.17)
17
+ sys-uname
18
+ autotest-growl (0.2.16)
19
+ autotest-rails-pure (4.1.2)
20
+ crack (0.4.3)
21
+ safe_yaml (~> 1.0.0)
22
+ diff-lcs (1.3)
23
+ ethon (0.12.0)
24
+ ffi (>= 1.3.0)
25
+ ffi (1.12.2)
26
+ hashdiff (1.0.1)
27
+ json (2.3.0)
28
+ public_suffix (4.0.4)
29
+ rake (12.0.0)
30
+ rspec (3.9.0)
31
+ rspec-core (~> 3.9.0)
32
+ rspec-expectations (~> 3.9.0)
33
+ rspec-mocks (~> 3.9.0)
34
+ rspec-core (3.9.1)
35
+ rspec-support (~> 3.9.1)
36
+ rspec-expectations (3.9.1)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.9.0)
39
+ rspec-mocks (3.9.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-support (3.9.2)
43
+ safe_yaml (1.0.5)
44
+ sys-uname (1.2.1)
45
+ ffi (>= 1.0.0)
46
+ typhoeus (1.3.1)
47
+ ethon (>= 0.9.0)
48
+ vcr (3.0.3)
49
+ webmock (1.24.6)
50
+ addressable (>= 2.3.6)
51
+ crack (>= 0.3.2)
52
+ hashdiff
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ autotest (~> 4.4, >= 4.4.6)
59
+ autotest-fsevent (~> 0.2, >= 0.2.12)
60
+ autotest-growl (~> 0.2, >= 0.2.16)
61
+ autotest-rails-pure (~> 4.1, >= 4.1.2)
62
+ dkron-ruby!
63
+ rake (~> 12.0.0)
64
+ rspec (~> 3.6, >= 3.6.0)
65
+ vcr (~> 3.0, >= 3.0.1)
66
+ webmock (~> 1.24, >= 1.24.3)
67
+
68
+ BUNDLED WITH
69
+ 1.17.3
data/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # dkron-ruby
2
+
3
+ Dkron - the Ruby gem for the Dkron REST API
4
+
5
+ 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.
6
+
7
+ This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
+
9
+ - API version: 2.2
10
+ - Package version: 1.0.0
11
+ - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
+
13
+ ## Installation
14
+
15
+ ### Build a gem
16
+
17
+ To build the Ruby code into a gem:
18
+
19
+ ```shell
20
+ gem build dkron-ruby.gemspec
21
+ ```
22
+
23
+ Then either install the gem locally:
24
+
25
+ ```shell
26
+ gem install ./dkron-ruby-1.0.0.gem
27
+ ```
28
+ (for development, run `gem install --dev ./dkron-ruby-1.0.0.gem` to install the development dependencies)
29
+
30
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
31
+
32
+ Finally add this to the Gemfile:
33
+
34
+ gem 'dkron-ruby', '~> 1.0.0'
35
+
36
+ ### Install from Git
37
+
38
+ If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO, then add the following in the Gemfile:
39
+
40
+ gem 'dkron-ruby', :git => 'https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO.git'
41
+
42
+ ### Include the Ruby code directly
43
+
44
+ Include the Ruby code directly using `-I` as follows:
45
+
46
+ ```shell
47
+ ruby -Ilib script.rb
48
+ ```
49
+
50
+ ## Getting Started
51
+
52
+ Please follow the [installation](#installation) procedure and then run the following code:
53
+ ```ruby
54
+ # Load the gem
55
+ require 'dkron-ruby'
56
+
57
+ api_instance = Dkron::DefaultApi.new
58
+
59
+ begin
60
+ result = api_instance.get_leader
61
+ p result
62
+ rescue Dkron::ApiError => e
63
+ puts "Exception when calling DefaultApi->get_leader: #{e}"
64
+ end
65
+
66
+ ```
67
+
68
+ ## Documentation for API Endpoints
69
+
70
+ All URIs are relative to *http://localhost:8080/v1*
71
+
72
+ Class | Method | HTTP request | Description
73
+ ------------ | ------------- | ------------- | -------------
74
+ *Dkron::DefaultApi* | [**get_leader**](docs/DefaultApi.md#get_leader) | **GET** /leader |
75
+ *Dkron::DefaultApi* | [**leave**](docs/DefaultApi.md#leave) | **POST** /leave |
76
+ *Dkron::DefaultApi* | [**status**](docs/DefaultApi.md#status) | **GET** / |
77
+ *Dkron::ExecutionsApi* | [**list_executions_by_job**](docs/ExecutionsApi.md#list_executions_by_job) | **GET** /jobs/{job_name}/executions |
78
+ *Dkron::JobsApi* | [**create_or_update_job**](docs/JobsApi.md#create_or_update_job) | **POST** /jobs |
79
+ *Dkron::JobsApi* | [**delete_job**](docs/JobsApi.md#delete_job) | **DELETE** /jobs/{job_name} |
80
+ *Dkron::JobsApi* | [**get_jobs**](docs/JobsApi.md#get_jobs) | **GET** /jobs |
81
+ *Dkron::JobsApi* | [**run_job**](docs/JobsApi.md#run_job) | **POST** /jobs/{job_name} |
82
+ *Dkron::JobsApi* | [**show_job_by_name**](docs/JobsApi.md#show_job_by_name) | **GET** /jobs/{job_name} |
83
+ *Dkron::JobsApi* | [**toggle_job**](docs/JobsApi.md#toggle_job) | **POST** /jobs/{job_name}/toggle |
84
+ *Dkron::MembersApi* | [**get_member**](docs/MembersApi.md#get_member) | **GET** /members |
85
+
86
+
87
+ ## Documentation for Models
88
+
89
+ - [Dkron::Execution](docs/Execution.md)
90
+ - [Dkron::Job](docs/Job.md)
91
+ - [Dkron::Member](docs/Member.md)
92
+ - [Dkron::Processors](docs/Processors.md)
93
+ - [Dkron::Status](docs/Status.md)
94
+
95
+
96
+ ## Documentation for Authorization
97
+
98
+ All endpoints do not require authorization.
99
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+ rescue LoadError
7
+ # no rspec available
8
+ end
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #Dkron REST API
5
+
6
+ #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.
7
+
8
+ OpenAPI spec version: 2.2
9
+
10
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
11
+ Swagger Codegen version: 2.4.13
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "dkron-ruby/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "dkron-ruby"
20
+ s.version = Dkron::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["Michael Haglund"]
23
+ s.email = ["michael.haglund@life.church"]
24
+ s.homepage = "https://github.com/swagger-api/swagger-codegen"
25
+ s.summary = "Dkron REST API Ruby Gem"
26
+ s.description = "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. "
27
+ s.license = "Unlicense"
28
+ s.required_ruby_version = ">= 1.9"
29
+
30
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
+ s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
+
33
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
+ s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
35
+ s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
36
+ s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
37
+ s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
38
+ s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
39
+ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
40
+
41
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
42
+ s.test_files = `find spec/*`.split("\n")
43
+ s.executables = []
44
+ s.require_paths = ["lib"]
45
+ end
@@ -0,0 +1,131 @@
1
+ # Dkron::DefaultApi
2
+
3
+ All URIs are relative to *http://localhost:8080/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**get_leader**](DefaultApi.md#get_leader) | **GET** /leader |
8
+ [**leave**](DefaultApi.md#leave) | **POST** /leave |
9
+ [**status**](DefaultApi.md#status) | **GET** / |
10
+
11
+
12
+ # **get_leader**
13
+ > Member get_leader
14
+
15
+
16
+
17
+ List leader of cluster.
18
+
19
+ ### Example
20
+ ```ruby
21
+ # load the gem
22
+ require 'dkron-ruby'
23
+
24
+ api_instance = Dkron::DefaultApi.new
25
+
26
+ begin
27
+ result = api_instance.get_leader
28
+ p result
29
+ rescue Dkron::ApiError => e
30
+ puts "Exception when calling DefaultApi->get_leader: #{e}"
31
+ end
32
+ ```
33
+
34
+ ### Parameters
35
+ This endpoint does not need any parameter.
36
+
37
+ ### Return type
38
+
39
+ [**Member**](Member.md)
40
+
41
+ ### Authorization
42
+
43
+ No authorization required
44
+
45
+ ### HTTP request headers
46
+
47
+ - **Content-Type**: application/json
48
+ - **Accept**: application/json
49
+
50
+
51
+
52
+ # **leave**
53
+ > Array&lt;Member&gt; leave
54
+
55
+
56
+
57
+ Force the node to leave the cluster.
58
+
59
+ ### Example
60
+ ```ruby
61
+ # load the gem
62
+ require 'dkron-ruby'
63
+
64
+ api_instance = Dkron::DefaultApi.new
65
+
66
+ begin
67
+ result = api_instance.leave
68
+ p result
69
+ rescue Dkron::ApiError => e
70
+ puts "Exception when calling DefaultApi->leave: #{e}"
71
+ end
72
+ ```
73
+
74
+ ### Parameters
75
+ This endpoint does not need any parameter.
76
+
77
+ ### Return type
78
+
79
+ [**Array&lt;Member&gt;**](Member.md)
80
+
81
+ ### Authorization
82
+
83
+ No authorization required
84
+
85
+ ### HTTP request headers
86
+
87
+ - **Content-Type**: application/json
88
+ - **Accept**: application/json
89
+
90
+
91
+
92
+ # **status**
93
+ > Status status
94
+
95
+
96
+
97
+ Gets `Status` object.
98
+
99
+ ### Example
100
+ ```ruby
101
+ # load the gem
102
+ require 'dkron-ruby'
103
+
104
+ api_instance = Dkron::DefaultApi.new
105
+
106
+ begin
107
+ result = api_instance.status
108
+ p result
109
+ rescue Dkron::ApiError => e
110
+ puts "Exception when calling DefaultApi->status: #{e}"
111
+ end
112
+ ```
113
+
114
+ ### Parameters
115
+ This endpoint does not need any parameter.
116
+
117
+ ### Return type
118
+
119
+ [**Status**](Status.md)
120
+
121
+ ### Authorization
122
+
123
+ No authorization required
124
+
125
+ ### HTTP request headers
126
+
127
+ - **Content-Type**: application/json
128
+ - **Accept**: application/json
129
+
130
+
131
+
data/docs/Execution.md ADDED
@@ -0,0 +1,13 @@
1
+ # Dkron::Execution
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **job_name** | **String** | job name | [optional]
7
+ **started_at** | **DateTime** | start time of the execution | [optional]
8
+ **finished_at** | **DateTime** | when the execution finished running | [optional]
9
+ **success** | **BOOLEAN** | the execution run successfuly | [optional]
10
+ **output** | **String** | partial output of the command execution | [optional]
11
+ **node_name** | **String** | name of the node that executed the command | [optional]
12
+
13
+
@@ -0,0 +1,55 @@
1
+ # Dkron::ExecutionsApi
2
+
3
+ All URIs are relative to *http://localhost:8080/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**list_executions_by_job**](ExecutionsApi.md#list_executions_by_job) | **GET** /jobs/{job_name}/executions |
8
+
9
+
10
+ # **list_executions_by_job**
11
+ > Array&lt;Execution&gt; list_executions_by_job(job_name)
12
+
13
+
14
+
15
+ List executions.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'dkron-ruby'
21
+
22
+ api_instance = Dkron::ExecutionsApi.new
23
+
24
+ job_name = 'job_name_example' # String | The job that owns the executions to be fetched.
25
+
26
+
27
+ begin
28
+ result = api_instance.list_executions_by_job(job_name)
29
+ p result
30
+ rescue Dkron::ApiError => e
31
+ puts "Exception when calling ExecutionsApi->list_executions_by_job: #{e}"
32
+ end
33
+ ```
34
+
35
+ ### Parameters
36
+
37
+ Name | Type | Description | Notes
38
+ ------------- | ------------- | ------------- | -------------
39
+ **job_name** | **String**| The job that owns the executions to be fetched. |
40
+
41
+ ### Return type
42
+
43
+ [**Array&lt;Execution&gt;**](Execution.md)
44
+
45
+ ### Authorization
46
+
47
+ No authorization required
48
+
49
+ ### HTTP request headers
50
+
51
+ - **Content-Type**: application/json
52
+ - **Accept**: application/json
53
+
54
+
55
+
data/docs/Job.md ADDED
@@ -0,0 +1,28 @@
1
+ # Dkron::Job
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **name** | **String** | Name for the job. |
7
+ **displayname** | **String** | Nice name for the job. Optional. | [optional]
8
+ **schedule** | **String** | Cron expression for the job. |
9
+ **timezone** | **String** | Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time. | [optional]
10
+ **owner** | **String** | Owner of the job | [optional]
11
+ **owner_email** | **String** | Email of the owner | [optional]
12
+ **success_count** | **Integer** | Number of successful executions | [optional]
13
+ **error_count** | **Integer** | Number of failed executions | [optional]
14
+ **last_success** | **DateTime** | Last time this job executed successfully | [optional]
15
+ **last_error** | **DateTime** | Last time this job failed | [optional]
16
+ **disabled** | **BOOLEAN** | Disabled state of the job | [optional]
17
+ **tags** | **Hash&lt;String, String&gt;** | Target nodes tags of this job | [optional]
18
+ **metadata** | **Hash&lt;String, String&gt;** | Extra metadata tags for this job | [optional]
19
+ **retries** | **Integer** | Number of times to retry a failed job execution | [optional]
20
+ **parent_job** | **String** | The name/id of the job that will trigger the execution of this job | [optional]
21
+ **dependent_jobs** | **Array&lt;String&gt;** | Array containing the jobs that depends on this one | [optional]
22
+ **processors** | [**Processors**](Processors.md) | | [optional]
23
+ **concurrency** | **String** | Concurrency policy for the job allow/forbid | [optional]
24
+ **executor** | **String** | Executor plugin used to run the job | [optional]
25
+ **executor_config** | **Hash&lt;String, String&gt;** | Executor plugin parameters | [optional]
26
+ **status** | **String** | Status of the job | [optional]
27
+
28
+