dkron-rb 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
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,90 @@
1
+ # Dkron::MainApi
2
+
3
+ All URIs are relative to *http://localhost:8080/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**get_leader**](MainApi.md#get_leader) | **GET** /leader |
8
+ [**status**](MainApi.md#status) | **GET** / |
9
+
10
+
11
+ # **get_leader**
12
+ > Member get_leader
13
+
14
+
15
+
16
+ List members.\n
17
+
18
+ ### Example
19
+ ```ruby
20
+ # load the gem
21
+ require 'dkron-rb'
22
+
23
+ api_instance = Dkron::MainApi.new
24
+
25
+ begin
26
+ result = api_instance.get_leader
27
+ p result
28
+ rescue Dkron::ApiError => e
29
+ puts "Exception when calling MainApi->get_leader: #{e}"
30
+ end
31
+ ```
32
+
33
+ ### Parameters
34
+ This endpoint does not need any parameter.
35
+
36
+ ### Return type
37
+
38
+ [**Member**](Member.md)
39
+
40
+ ### Authorization
41
+
42
+ No authorization required
43
+
44
+ ### HTTP reuqest headers
45
+
46
+ - **Content-Type**: application/json
47
+ - **Accept**: application/json
48
+
49
+
50
+
51
+ # **status**
52
+ > InlineResponse200 status
53
+
54
+
55
+
56
+ Gets `Status` object.\n
57
+
58
+ ### Example
59
+ ```ruby
60
+ # load the gem
61
+ require 'dkron-rb'
62
+
63
+ api_instance = Dkron::MainApi.new
64
+
65
+ begin
66
+ result = api_instance.status
67
+ p result
68
+ rescue Dkron::ApiError => e
69
+ puts "Exception when calling MainApi->status: #{e}"
70
+ end
71
+ ```
72
+
73
+ ### Parameters
74
+ This endpoint does not need any parameter.
75
+
76
+ ### Return type
77
+
78
+ [**InlineResponse200**](InlineResponse200.md)
79
+
80
+ ### Authorization
81
+
82
+ No authorization required
83
+
84
+ ### HTTP reuqest headers
85
+
86
+ - **Content-Type**: application/json
87
+ - **Accept**: application/json
88
+
89
+
90
+
@@ -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<String, String>** | 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** | | [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 minimum version this node can understand or speak | [optional]
16
+ **delegate_cur** | **Integer** | Serf delegate protocol minimum 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<Member> get_member
12
+
13
+
14
+
15
+ List members.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'dkron-rb'
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<Member>**](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::Serf
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+
7
+
@@ -0,0 +1,7 @@
1
+ # Dkron::Status
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+
7
+
@@ -0,0 +1,7 @@
1
+ # Dkron::Tags
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+
7
+
@@ -0,0 +1,67 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
18
+ #
19
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
20
+
21
+ git_user_id=$1
22
+ git_repo_id=$2
23
+ release_note=$3
24
+
25
+ if [ "$git_user_id" = "" ]; then
26
+ git_user_id="GIT_USER_ID"
27
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
28
+ fi
29
+
30
+ if [ "$git_repo_id" = "" ]; then
31
+ git_repo_id="GIT_REPO_ID"
32
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
33
+ fi
34
+
35
+ if [ "$release_note" = "" ]; then
36
+ release_note="Minor update"
37
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
38
+ fi
39
+
40
+ # Initialize the local directory as a Git repository
41
+ git init
42
+
43
+ # Adds the files in the local repository and stages them for commit.
44
+ git add .
45
+
46
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
47
+ git commit -m "$release_note"
48
+
49
+ # Sets the new remote
50
+ git_remote=`git remote`
51
+ if [ "$git_remote" = "" ]; then # git remote not defined
52
+
53
+ if [ "$GIT_TOKEN" = "" ]; then
54
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
55
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
56
+ else
57
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
58
+ fi
59
+
60
+ fi
61
+
62
+ git pull origin master
63
+
64
+ # Pushes (Forces) the changes in the local repository up to the remote repository
65
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
66
+ git push origin master 2>&1 | grep -v 'To https'
67
+
@@ -0,0 +1,47 @@
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.9.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'dkron-rb/api_client'
15
+ require 'dkron-rb/api_error'
16
+ require 'dkron-rb/version'
17
+ require 'dkron-rb/configuration'
18
+
19
+ # Models
20
+ require 'dkron-rb/models/execution'
21
+ require 'dkron-rb/models/job'
22
+ require 'dkron-rb/models/member'
23
+ require 'dkron-rb/models/status'
24
+
25
+ # APIs
26
+ require 'dkron-rb/api/default_api'
27
+ require 'dkron-rb/api/executions_api'
28
+ require 'dkron-rb/api/jobs_api'
29
+ require 'dkron-rb/api/members_api'
30
+
31
+ module Dkron
32
+ class << self
33
+ # Customize default settings for the SDK using block.
34
+ # Dkron.configure do |config|
35
+ # config.username = "xxx"
36
+ # config.password = "xxx"
37
+ # end
38
+ # If no block given, return the default Configuration object.
39
+ def configure
40
+ if block_given?
41
+ yield(Configuration.default)
42
+ else
43
+ Configuration.default
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,193 @@
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 "uri"
25
+
26
+ module Dkron
27
+ class DefaultApi
28
+ attr_accessor :api_client
29
+
30
+ def initialize(api_client = ApiClient.default)
31
+ @api_client = api_client
32
+ end
33
+
34
+ #
35
+ # List members.
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Member]
38
+ def get_leader(opts = {})
39
+ data, _status_code, _headers = get_leader_with_http_info(opts)
40
+ return data
41
+ end
42
+
43
+ #
44
+ # List members.
45
+ # @param [Hash] opts the optional parameters
46
+ # @return [Array<(Member, Fixnum, Hash)>] Member data, response status code and response headers
47
+ def get_leader_with_http_info(opts = {})
48
+ if @api_client.config.debugging
49
+ @api_client.config.logger.debug "Calling API: DefaultApi.get_leader ..."
50
+ end
51
+ # resource path
52
+ local_var_path = "/leader".sub('{format}','json')
53
+
54
+ # query parameters
55
+ query_params = {}
56
+
57
+ # header parameters
58
+ header_params = {}
59
+
60
+ # HTTP header 'Accept' (if needed)
61
+ local_header_accept = ['application/json']
62
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
63
+
64
+ # HTTP header 'Content-Type'
65
+ local_header_content_type = ['application/json']
66
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
67
+
68
+ # form parameters
69
+ form_params = {}
70
+
71
+ # http body (model)
72
+ post_body = nil
73
+ auth_names = []
74
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => 'Member')
81
+ if @api_client.config.debugging
82
+ @api_client.config.logger.debug "API called: DefaultApi#get_leader\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
83
+ end
84
+ return data, status_code, headers
85
+ end
86
+
87
+ #
88
+ # Force the node to leave the cluster.
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Array<Member>]
91
+ def leave(opts = {})
92
+ data, _status_code, _headers = leave_with_http_info(opts)
93
+ return data
94
+ end
95
+
96
+ #
97
+ # Force the node to leave the cluster.
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [Array<(Array<Member>, Fixnum, Hash)>] Array<Member> data, response status code and response headers
100
+ def leave_with_http_info(opts = {})
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug "Calling API: DefaultApi.leave ..."
103
+ end
104
+ # resource path
105
+ local_var_path = "/leave".sub('{format}','json')
106
+
107
+ # query parameters
108
+ query_params = {}
109
+
110
+ # header parameters
111
+ header_params = {}
112
+
113
+ # HTTP header 'Accept' (if needed)
114
+ local_header_accept = ['application/json']
115
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
116
+
117
+ # HTTP header 'Content-Type'
118
+ local_header_content_type = ['application/json']
119
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
120
+
121
+ # form parameters
122
+ form_params = {}
123
+
124
+ # http body (model)
125
+ post_body = nil
126
+ auth_names = []
127
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
128
+ :header_params => header_params,
129
+ :query_params => query_params,
130
+ :form_params => form_params,
131
+ :body => post_body,
132
+ :auth_names => auth_names,
133
+ :return_type => 'Array<Member>')
134
+ if @api_client.config.debugging
135
+ @api_client.config.logger.debug "API called: DefaultApi#leave\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
136
+ end
137
+ return data, status_code, headers
138
+ end
139
+
140
+ #
141
+ # Gets `Status` object.
142
+ # @param [Hash] opts the optional parameters
143
+ # @return [Status]
144
+ def status(opts = {})
145
+ data, _status_code, _headers = status_with_http_info(opts)
146
+ return data
147
+ end
148
+
149
+ #
150
+ # Gets &#x60;Status&#x60; object.
151
+ # @param [Hash] opts the optional parameters
152
+ # @return [Array<(Status, Fixnum, Hash)>] Status data, response status code and response headers
153
+ def status_with_http_info(opts = {})
154
+ if @api_client.config.debugging
155
+ @api_client.config.logger.debug "Calling API: DefaultApi.status ..."
156
+ end
157
+ # resource path
158
+ local_var_path = "/".sub('{format}','json')
159
+
160
+ # query parameters
161
+ query_params = {}
162
+
163
+ # header parameters
164
+ header_params = {}
165
+
166
+ # HTTP header 'Accept' (if needed)
167
+ local_header_accept = ['application/json']
168
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
169
+
170
+ # HTTP header 'Content-Type'
171
+ local_header_content_type = ['application/json']
172
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
173
+
174
+ # form parameters
175
+ form_params = {}
176
+
177
+ # http body (model)
178
+ post_body = nil
179
+ auth_names = []
180
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
181
+ :header_params => header_params,
182
+ :query_params => query_params,
183
+ :form_params => form_params,
184
+ :body => post_body,
185
+ :auth_names => auth_names,
186
+ :return_type => 'Status')
187
+ if @api_client.config.debugging
188
+ @api_client.config.logger.debug "API called: DefaultApi#status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
189
+ end
190
+ return data, status_code, headers
191
+ end
192
+ end
193
+ end