cloudmunda 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -7
- data/.rubocop_todo.yml +39 -0
- data/CHANGELOG.md +13 -1
- data/Gemfile +5 -6
- data/Gemfile.lock +153 -1
- data/README.md +173 -4
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/diagrams/demo.bpmn +47 -0
- data/exe/cloudmunda +17 -0
- data/lib/cloudmunda/api/access_token.rb +19 -0
- data/lib/cloudmunda/api/client.rb +29 -0
- data/lib/cloudmunda/api/o_auth_resource.rb +15 -0
- data/lib/cloudmunda/api.rb +5 -0
- data/lib/cloudmunda/cli/launcher.rb +36 -0
- data/lib/cloudmunda/cli/processor.rb +110 -0
- data/lib/cloudmunda/cli/supervisor.rb +45 -0
- data/lib/cloudmunda/cli/worker.rb +186 -0
- data/lib/cloudmunda/cli.rb +168 -0
- data/lib/cloudmunda/configuration.rb +38 -0
- data/lib/cloudmunda/graphql/client.rb +30 -0
- data/lib/cloudmunda/graphql/user_tasks.rb +35 -0
- data/lib/cloudmunda/graphql.rb +4 -0
- data/lib/cloudmunda/loggable.rb +17 -0
- data/lib/cloudmunda/version.rb +1 -1
- data/lib/cloudmunda/zeebe/client.rb +96 -0
- data/lib/cloudmunda/zeebe.rb +3 -0
- data/lib/cloudmunda.rb +23 -3
- metadata +67 -8
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'zeebe/client'
|
4
|
+
|
5
|
+
module Cloudmunda
|
6
|
+
module Zeebe
|
7
|
+
class Client
|
8
|
+
attr_reader :client
|
9
|
+
|
10
|
+
def initialize(url: ::Cloudmunda.zeebe_url)
|
11
|
+
@client = ::Zeebe::Client::GatewayProtocol::Gateway::Stub.new(url, authentication_headers)
|
12
|
+
end
|
13
|
+
|
14
|
+
def activate_jobs(params = {})
|
15
|
+
run(:activate_jobs,
|
16
|
+
::Zeebe::Client::GatewayProtocol::ActivateJobsRequest.new(params))
|
17
|
+
end
|
18
|
+
|
19
|
+
def cancel_workflow_instance(params = {})
|
20
|
+
run(:cancel_workflow_instance,
|
21
|
+
::Zeebe::Client::GatewayProtocol::CancelWorkflowInstanceRequest.new(params))
|
22
|
+
end
|
23
|
+
|
24
|
+
def complete_job(params = {})
|
25
|
+
run(:complete_job,
|
26
|
+
::Zeebe::Client::GatewayProtocol::CompleteJobRequest.new(params))
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_process_instance(params = {})
|
30
|
+
run(:create_process_instance,
|
31
|
+
::Zeebe::Client::GatewayProtocol::CreateProcessInstanceRequest.new(params))
|
32
|
+
end
|
33
|
+
|
34
|
+
def deploy_process(params = {})
|
35
|
+
run(:deploy_process,
|
36
|
+
::Zeebe::Client::GatewayProtocol::DeployProcessRequest.new(params))
|
37
|
+
end
|
38
|
+
|
39
|
+
def fail_job(params = {})
|
40
|
+
run(:fail_job,
|
41
|
+
::Zeebe::Client::GatewayProtocol::FailJobRequest.new(params))
|
42
|
+
end
|
43
|
+
|
44
|
+
def throw_error(params = {})
|
45
|
+
run(:throw_error,
|
46
|
+
::Zeebe::Client::GatewayProtocol::ThrowErrorRequest.new(params))
|
47
|
+
end
|
48
|
+
|
49
|
+
def publish_message(params = {})
|
50
|
+
run(:publish_message,
|
51
|
+
::Zeebe::Client::GatewayProtocol::PublishMessageRequest.new(params))
|
52
|
+
end
|
53
|
+
|
54
|
+
def resolve_incident(params = {})
|
55
|
+
run(:resolve_incident,
|
56
|
+
::Zeebe::Client::GatewayProtocol::ResolveIncidentRequest.new(params))
|
57
|
+
end
|
58
|
+
|
59
|
+
def set_variables(params = {})
|
60
|
+
run(:set_variables,
|
61
|
+
::Zeebe::Client::GatewayProtocol::SetVariablesRequest.new(params))
|
62
|
+
end
|
63
|
+
|
64
|
+
def topology(params = {})
|
65
|
+
run(:topology,
|
66
|
+
::Zeebe::Client::GatewayProtocol::TopologyRequest.new(params))
|
67
|
+
end
|
68
|
+
|
69
|
+
def update_job_retries(params = {})
|
70
|
+
run(:update_job_retries,
|
71
|
+
::Zeebe::Client::GatewayProtocol::UpdateJobRetriesRequest.new(params))
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def run(method, params = {})
|
77
|
+
client.public_send(method, params)
|
78
|
+
rescue ::GRPC::Unavailable => e
|
79
|
+
logger.error e.message
|
80
|
+
raise e
|
81
|
+
end
|
82
|
+
|
83
|
+
def logger
|
84
|
+
# ::Cloudmunda.logger
|
85
|
+
end
|
86
|
+
|
87
|
+
def authentication_headers
|
88
|
+
token = Cloudmunda::API::AccessToken.create
|
89
|
+
channel_creds = GRPC::Core::ChannelCredentials.new
|
90
|
+
auth_proc = proc { { 'authorization' => "Bearer #{token.access_token}" } }
|
91
|
+
call_creds = GRPC::Core::CallCredentials.new(auth_proc)
|
92
|
+
channel_creds.compose(call_creds)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/cloudmunda.rb
CHANGED
@@ -1,8 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'concurrent'
|
4
|
+
|
5
|
+
require_relative 'cloudmunda/version'
|
6
|
+
require_relative 'cloudmunda/loggable'
|
7
|
+
require_relative 'cloudmunda/cli/worker'
|
8
|
+
require_relative 'cloudmunda/configuration'
|
9
|
+
require_relative 'cloudmunda/api'
|
10
|
+
require_relative 'cloudmunda/zeebe'
|
11
|
+
require_relative 'cloudmunda/graphql'
|
4
12
|
|
5
13
|
module Cloudmunda
|
6
|
-
|
7
|
-
|
14
|
+
extend Configuration
|
15
|
+
extend Loggable
|
16
|
+
|
17
|
+
def self.client
|
18
|
+
@client ||= ::Cloudmunda::Zeebe::Client.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.register_worker(worker)
|
22
|
+
workers << worker
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.workers
|
26
|
+
@workers ||= []
|
27
|
+
end
|
8
28
|
end
|
metadata
CHANGED
@@ -1,24 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmunda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lien Van Den Steen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2022-02-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: zeebe-client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.16'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.16'
|
13
55
|
description: Ruby wrapper for Camunda Cloud
|
14
56
|
email:
|
15
57
|
- lienvandensteen@gmail.com
|
16
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- cloudmunda
|
17
60
|
extensions: []
|
18
61
|
extra_rdoc_files: []
|
19
62
|
files:
|
20
63
|
- ".rspec"
|
21
64
|
- ".rubocop.yml"
|
65
|
+
- ".rubocop_todo.yml"
|
22
66
|
- CHANGELOG.md
|
23
67
|
- CODE_OF_CONDUCT.md
|
24
68
|
- Gemfile
|
@@ -28,16 +72,31 @@ files:
|
|
28
72
|
- Rakefile
|
29
73
|
- bin/console
|
30
74
|
- bin/setup
|
75
|
+
- diagrams/demo.bpmn
|
76
|
+
- exe/cloudmunda
|
31
77
|
- lib/cloudmunda.rb
|
78
|
+
- lib/cloudmunda/api.rb
|
79
|
+
- lib/cloudmunda/api/access_token.rb
|
80
|
+
- lib/cloudmunda/api/client.rb
|
81
|
+
- lib/cloudmunda/api/o_auth_resource.rb
|
82
|
+
- lib/cloudmunda/cli.rb
|
83
|
+
- lib/cloudmunda/cli/launcher.rb
|
84
|
+
- lib/cloudmunda/cli/processor.rb
|
85
|
+
- lib/cloudmunda/cli/supervisor.rb
|
86
|
+
- lib/cloudmunda/cli/worker.rb
|
87
|
+
- lib/cloudmunda/configuration.rb
|
88
|
+
- lib/cloudmunda/graphql.rb
|
89
|
+
- lib/cloudmunda/graphql/client.rb
|
90
|
+
- lib/cloudmunda/graphql/user_tasks.rb
|
91
|
+
- lib/cloudmunda/loggable.rb
|
32
92
|
- lib/cloudmunda/version.rb
|
93
|
+
- lib/cloudmunda/zeebe.rb
|
94
|
+
- lib/cloudmunda/zeebe/client.rb
|
33
95
|
homepage: https://github.com/lienvdsteen/cloudmunda
|
34
96
|
licenses:
|
35
97
|
- MIT
|
36
98
|
metadata:
|
37
|
-
|
38
|
-
homepage_uri: https://github.com/lienvdsteen/cloudmunda
|
39
|
-
source_code_uri: https://github.com/lienvdsteen/cloudmunda
|
40
|
-
changelog_uri: https://github.com/lienvdsteen/cloudmunda
|
99
|
+
rubygems_mfa_required: 'true'
|
41
100
|
post_install_message:
|
42
101
|
rdoc_options: []
|
43
102
|
require_paths:
|