dapr-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +45 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dapr.gemspec +47 -0
- data/example.rb +25 -0
- data/lib/dapr/generated/dapr_pb.rb +99 -0
- data/lib/dapr/generated/dapr_services_pb.rb +29 -0
- data/lib/dapr/generated/daprclient_pb.rb +72 -0
- data/lib/dapr/generated/daprclient_services_pb.rb +27 -0
- data/lib/dapr/version.rb +3 -0
- data/lib/dapr-client.rb +3 -0
- data/lib/dapr.rb +1 -0
- data/proto/dapr.proto +108 -0
- data/proto/daprclient.proto +76 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 76432e4fbd3b38d79bd33a4ceaf47da100dd830c622229fc5c8dbedea79e4d8b
|
4
|
+
data.tar.gz: 33fe1e47295af0fd07278b001fa0c7518b6e7017c23d23ece9f896a87ea377b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f6c69c223c3c720d4f239d9e9455f48ec86413c39dd94986dba5b33d7474c13e50d0ce3a329bbf35f1680f1c04e991301b8bb45a2732369e4adefcecc4c2b17c
|
7
|
+
data.tar.gz: 3f0f4b799cc2053bb2016584234f3ebcb2fedd476d3409f021b35a8807087c9a11067e49439a6176db5c86483fab4d5422fc030b0b8013cae4a5a7d0c385f556
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
dapr
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.7
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dapr-client (0.1.0)
|
5
|
+
google-protobuf
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
google-protobuf (3.11.4)
|
12
|
+
googleapis-common-protos-types (1.0.4)
|
13
|
+
google-protobuf (~> 3.0)
|
14
|
+
grpc (1.27.0)
|
15
|
+
google-protobuf (~> 3.11)
|
16
|
+
googleapis-common-protos-types (~> 1.0)
|
17
|
+
grpc-tools (1.28.0)
|
18
|
+
rake (13.0.1)
|
19
|
+
rspec (3.9.0)
|
20
|
+
rspec-core (~> 3.9.0)
|
21
|
+
rspec-expectations (~> 3.9.0)
|
22
|
+
rspec-mocks (~> 3.9.0)
|
23
|
+
rspec-core (3.9.1)
|
24
|
+
rspec-support (~> 3.9.1)
|
25
|
+
rspec-expectations (3.9.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.9.0)
|
28
|
+
rspec-mocks (3.9.1)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.9.0)
|
31
|
+
rspec-support (3.9.2)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
bundler (~> 1.17)
|
38
|
+
dapr-client!
|
39
|
+
grpc
|
40
|
+
grpc-tools
|
41
|
+
rake (>= 12.3.3)
|
42
|
+
rspec (~> 3.0)
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Tim Perkins
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Dapr SDK for Ruby
|
2
|
+
|
3
|
+
This is the Dapr SDK for Ruby, based on the auto-generated proto client.<br>
|
4
|
+
|
5
|
+
For more info on Dapr and gRPC, visit [this link](https://github.com/dapr/docs/tree/master/howto/create-grpc-app).
|
6
|
+
|
7
|
+
The repository generates the following package
|
8
|
+
- dapr-client
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'dapr-client'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install dapr-client
|
25
|
+
|
26
|
+
## Example Code
|
27
|
+
|
28
|
+
A client can be created as follows:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require "dapr/generated/dapr_services_pb"
|
32
|
+
|
33
|
+
client = Dapr::Dapr::Stub.new('localhost:5001', :this_channel_is_insecure)
|
34
|
+
```
|
35
|
+
|
36
|
+
You can find a complete example [here](https://github.com/tjwp/dapr-ruby-sdk/blob/master/example.rb)
|
37
|
+
|
38
|
+
### Running the code locally
|
39
|
+
|
40
|
+
You can execute this code using the local dapr runtime:
|
41
|
+
|
42
|
+
```sh
|
43
|
+
dapr run --protocol grpc --grpc-port=50001 ruby example.rb
|
44
|
+
```
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
49
|
+
|
50
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dapr.
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dapr"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/dapr.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "dapr/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dapr-client"
|
8
|
+
spec.version = Dapr::VERSION
|
9
|
+
spec.authors = ["tjwp"]
|
10
|
+
spec.email = ["tjwp@users.noreply.github.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Dapr SDK for Ruby}
|
13
|
+
spec.description = %q{Dapr SDK for Ruby}
|
14
|
+
spec.homepage = "https://github.com/tjwp/dapr-ruby-sdk"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
24
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
25
|
+
spec.metadata["github_repo"] = "ssh://github.com/tjwp/dapr-ruby-sdk"
|
26
|
+
else
|
27
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
28
|
+
"public gem pushes."
|
29
|
+
end
|
30
|
+
|
31
|
+
# Specify which files should be added to the gem when it is released.
|
32
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
33
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
34
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
35
|
+
end
|
36
|
+
spec.bindir = "exe"
|
37
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
|
+
spec.require_paths = ["lib", "lib/dapr/generated"]
|
39
|
+
|
40
|
+
spec.add_runtime_dependency "google-protobuf"
|
41
|
+
|
42
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
43
|
+
spec.add_development_dependency "grpc"
|
44
|
+
spec.add_development_dependency "grpc-tools"
|
45
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
46
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
47
|
+
end
|
data/example.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dapr/generated/dapr_services_pb"
|
4
|
+
|
5
|
+
port = ENV.fetch('DAPR_GRPC_PORT', '5001')
|
6
|
+
dapr_uri = "localhost:#{port}"
|
7
|
+
|
8
|
+
client = Dapr::Dapr::Stub.new(dapr_uri, :this_channel_is_insecure)
|
9
|
+
data = Google::Protobuf::Any.new(value: 'lala')
|
10
|
+
client.publish_event(Dapr::PublishEventEnvelope.new(topic: 'sith', data: data))
|
11
|
+
puts('Published')
|
12
|
+
|
13
|
+
key = 'mykey'
|
14
|
+
store_name = 'statestore'
|
15
|
+
req = Dapr::StateRequest.new(key: key, value: Google::Protobuf::Any.new(value: 'my state'))
|
16
|
+
state = Dapr::SaveStateEnvelope.new(storeName: store_name, requests: [req])
|
17
|
+
client.save_state(state)
|
18
|
+
puts('Saved!')
|
19
|
+
|
20
|
+
resp = client.get_state(Dapr::GetStateEnvelope.new(storeName: store_name, key: key))
|
21
|
+
puts('Got state!')
|
22
|
+
puts(resp)
|
23
|
+
|
24
|
+
client.delete_state(Dapr::DeleteStateEnvelope.new(storeName: store_name, key: key))
|
25
|
+
puts('Deleted!')
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: dapr.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/protobuf/any_pb'
|
7
|
+
require 'google/protobuf/empty_pb'
|
8
|
+
require 'google/protobuf/duration_pb'
|
9
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
+
add_file("dapr.proto", :syntax => :proto3) do
|
11
|
+
add_message "dapr.InvokeServiceResponseEnvelope" do
|
12
|
+
optional :data, :message, 1, "google.protobuf.Any"
|
13
|
+
map :metadata, :string, :string, 2
|
14
|
+
end
|
15
|
+
add_message "dapr.DeleteStateEnvelope" do
|
16
|
+
optional :storeName, :string, 1
|
17
|
+
optional :key, :string, 2
|
18
|
+
optional :etag, :string, 3
|
19
|
+
optional :options, :message, 4, "dapr.StateOptions"
|
20
|
+
end
|
21
|
+
add_message "dapr.SaveStateEnvelope" do
|
22
|
+
optional :storeName, :string, 1
|
23
|
+
repeated :requests, :message, 2, "dapr.StateRequest"
|
24
|
+
end
|
25
|
+
add_message "dapr.GetStateEnvelope" do
|
26
|
+
optional :storeName, :string, 1
|
27
|
+
optional :key, :string, 2
|
28
|
+
optional :consistency, :string, 3
|
29
|
+
end
|
30
|
+
add_message "dapr.GetStateResponseEnvelope" do
|
31
|
+
optional :data, :message, 1, "google.protobuf.Any"
|
32
|
+
optional :etag, :string, 2
|
33
|
+
end
|
34
|
+
add_message "dapr.GetSecretEnvelope" do
|
35
|
+
optional :storeName, :string, 1
|
36
|
+
optional :key, :string, 2
|
37
|
+
map :metadata, :string, :string, 3
|
38
|
+
end
|
39
|
+
add_message "dapr.GetSecretResponseEnvelope" do
|
40
|
+
map :data, :string, :string, 1
|
41
|
+
end
|
42
|
+
add_message "dapr.InvokeBindingEnvelope" do
|
43
|
+
optional :name, :string, 1
|
44
|
+
optional :data, :message, 2, "google.protobuf.Any"
|
45
|
+
map :metadata, :string, :string, 3
|
46
|
+
end
|
47
|
+
add_message "dapr.InvokeServiceEnvelope" do
|
48
|
+
optional :id, :string, 1
|
49
|
+
optional :method, :string, 2
|
50
|
+
optional :data, :message, 3, "google.protobuf.Any"
|
51
|
+
map :metadata, :string, :string, 4
|
52
|
+
end
|
53
|
+
add_message "dapr.PublishEventEnvelope" do
|
54
|
+
optional :topic, :string, 1
|
55
|
+
optional :data, :message, 2, "google.protobuf.Any"
|
56
|
+
end
|
57
|
+
add_message "dapr.State" do
|
58
|
+
optional :key, :string, 1
|
59
|
+
optional :value, :message, 2, "google.protobuf.Any"
|
60
|
+
optional :etag, :string, 3
|
61
|
+
map :metadata, :string, :string, 4
|
62
|
+
optional :options, :message, 5, "dapr.StateOptions"
|
63
|
+
end
|
64
|
+
add_message "dapr.StateOptions" do
|
65
|
+
optional :concurrency, :string, 1
|
66
|
+
optional :consistency, :string, 2
|
67
|
+
optional :retryPolicy, :message, 3, "dapr.RetryPolicy"
|
68
|
+
end
|
69
|
+
add_message "dapr.RetryPolicy" do
|
70
|
+
optional :threshold, :int32, 1
|
71
|
+
optional :pattern, :string, 2
|
72
|
+
optional :interval, :message, 3, "google.protobuf.Duration"
|
73
|
+
end
|
74
|
+
add_message "dapr.StateRequest" do
|
75
|
+
optional :key, :string, 1
|
76
|
+
optional :value, :message, 2, "google.protobuf.Any"
|
77
|
+
optional :etag, :string, 3
|
78
|
+
map :metadata, :string, :string, 4
|
79
|
+
optional :options, :message, 5, "dapr.StateOptions"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
module Dapr
|
85
|
+
InvokeServiceResponseEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.InvokeServiceResponseEnvelope").msgclass
|
86
|
+
DeleteStateEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.DeleteStateEnvelope").msgclass
|
87
|
+
SaveStateEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.SaveStateEnvelope").msgclass
|
88
|
+
GetStateEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.GetStateEnvelope").msgclass
|
89
|
+
GetStateResponseEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.GetStateResponseEnvelope").msgclass
|
90
|
+
GetSecretEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.GetSecretEnvelope").msgclass
|
91
|
+
GetSecretResponseEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.GetSecretResponseEnvelope").msgclass
|
92
|
+
InvokeBindingEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.InvokeBindingEnvelope").msgclass
|
93
|
+
InvokeServiceEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.InvokeServiceEnvelope").msgclass
|
94
|
+
PublishEventEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.PublishEventEnvelope").msgclass
|
95
|
+
State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.State").msgclass
|
96
|
+
StateOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.StateOptions").msgclass
|
97
|
+
RetryPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.RetryPolicy").msgclass
|
98
|
+
StateRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("dapr.StateRequest").msgclass
|
99
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: dapr.proto for package 'dapr'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'dapr_pb'
|
6
|
+
|
7
|
+
module Dapr
|
8
|
+
module Dapr
|
9
|
+
# Dapr definitions
|
10
|
+
class Service
|
11
|
+
|
12
|
+
include GRPC::GenericService
|
13
|
+
|
14
|
+
self.marshal_class_method = :encode
|
15
|
+
self.unmarshal_class_method = :decode
|
16
|
+
self.service_name = 'dapr.Dapr'
|
17
|
+
|
18
|
+
rpc :PublishEvent, PublishEventEnvelope, Google::Protobuf::Empty
|
19
|
+
rpc :InvokeService, InvokeServiceEnvelope, InvokeServiceResponseEnvelope
|
20
|
+
rpc :InvokeBinding, InvokeBindingEnvelope, Google::Protobuf::Empty
|
21
|
+
rpc :GetState, GetStateEnvelope, GetStateResponseEnvelope
|
22
|
+
rpc :GetSecret, GetSecretEnvelope, GetSecretResponseEnvelope
|
23
|
+
rpc :SaveState, SaveStateEnvelope, Google::Protobuf::Empty
|
24
|
+
rpc :DeleteState, DeleteStateEnvelope, Google::Protobuf::Empty
|
25
|
+
end
|
26
|
+
|
27
|
+
Stub = Service.rpc_stub_class
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: daprclient.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/protobuf/any_pb'
|
7
|
+
require 'google/protobuf/empty_pb'
|
8
|
+
require 'google/protobuf/duration_pb'
|
9
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
+
add_file("daprclient.proto", :syntax => :proto3) do
|
11
|
+
add_message "daprclient.CloudEventEnvelope" do
|
12
|
+
optional :id, :string, 1
|
13
|
+
optional :source, :string, 2
|
14
|
+
optional :type, :string, 3
|
15
|
+
optional :specVersion, :string, 4
|
16
|
+
optional :dataContentType, :string, 5
|
17
|
+
optional :topic, :string, 6
|
18
|
+
optional :data, :message, 7, "google.protobuf.Any"
|
19
|
+
end
|
20
|
+
add_message "daprclient.BindingEventEnvelope" do
|
21
|
+
optional :name, :string, 1
|
22
|
+
optional :data, :message, 2, "google.protobuf.Any"
|
23
|
+
map :metadata, :string, :string, 3
|
24
|
+
end
|
25
|
+
add_message "daprclient.BindingResponseEnvelope" do
|
26
|
+
optional :data, :message, 1, "google.protobuf.Any"
|
27
|
+
repeated :to, :string, 2
|
28
|
+
repeated :state, :message, 3, "daprclient.State"
|
29
|
+
optional :concurrency, :string, 4
|
30
|
+
end
|
31
|
+
add_message "daprclient.InvokeEnvelope" do
|
32
|
+
optional :method, :string, 1
|
33
|
+
optional :data, :message, 2, "google.protobuf.Any"
|
34
|
+
map :metadata, :string, :string, 3
|
35
|
+
end
|
36
|
+
add_message "daprclient.GetTopicSubscriptionsEnvelope" do
|
37
|
+
repeated :topics, :string, 1
|
38
|
+
end
|
39
|
+
add_message "daprclient.GetBindingsSubscriptionsEnvelope" do
|
40
|
+
repeated :bindings, :string, 1
|
41
|
+
end
|
42
|
+
add_message "daprclient.State" do
|
43
|
+
optional :key, :string, 1
|
44
|
+
optional :value, :message, 2, "google.protobuf.Any"
|
45
|
+
optional :etag, :string, 3
|
46
|
+
map :metadata, :string, :string, 4
|
47
|
+
optional :options, :message, 5, "daprclient.StateOptions"
|
48
|
+
end
|
49
|
+
add_message "daprclient.StateOptions" do
|
50
|
+
optional :concurrency, :string, 1
|
51
|
+
optional :consistency, :string, 2
|
52
|
+
optional :retryPolicy, :message, 3, "daprclient.RetryPolicy"
|
53
|
+
end
|
54
|
+
add_message "daprclient.RetryPolicy" do
|
55
|
+
optional :threshold, :int32, 1
|
56
|
+
optional :pattern, :string, 2
|
57
|
+
optional :interval, :message, 3, "google.protobuf.Duration"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
module Daprclient
|
63
|
+
CloudEventEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.CloudEventEnvelope").msgclass
|
64
|
+
BindingEventEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.BindingEventEnvelope").msgclass
|
65
|
+
BindingResponseEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.BindingResponseEnvelope").msgclass
|
66
|
+
InvokeEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.InvokeEnvelope").msgclass
|
67
|
+
GetTopicSubscriptionsEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.GetTopicSubscriptionsEnvelope").msgclass
|
68
|
+
GetBindingsSubscriptionsEnvelope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.GetBindingsSubscriptionsEnvelope").msgclass
|
69
|
+
State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.State").msgclass
|
70
|
+
StateOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.StateOptions").msgclass
|
71
|
+
RetryPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("daprclient.RetryPolicy").msgclass
|
72
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: daprclient.proto for package 'daprclient'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'daprclient_pb'
|
6
|
+
|
7
|
+
module Daprclient
|
8
|
+
module DaprClient
|
9
|
+
# User Code definitions
|
10
|
+
class Service
|
11
|
+
|
12
|
+
include GRPC::GenericService
|
13
|
+
|
14
|
+
self.marshal_class_method = :encode
|
15
|
+
self.unmarshal_class_method = :decode
|
16
|
+
self.service_name = 'daprclient.DaprClient'
|
17
|
+
|
18
|
+
rpc :OnInvoke, InvokeEnvelope, Google::Protobuf::Any
|
19
|
+
rpc :GetTopicSubscriptions, Google::Protobuf::Empty, GetTopicSubscriptionsEnvelope
|
20
|
+
rpc :GetBindingsSubscriptions, Google::Protobuf::Empty, GetBindingsSubscriptionsEnvelope
|
21
|
+
rpc :OnBindingEvent, BindingEventEnvelope, BindingResponseEnvelope
|
22
|
+
rpc :OnTopicEvent, CloudEventEnvelope, Google::Protobuf::Empty
|
23
|
+
end
|
24
|
+
|
25
|
+
Stub = Service.rpc_stub_class
|
26
|
+
end
|
27
|
+
end
|
data/lib/dapr/version.rb
ADDED
data/lib/dapr-client.rb
ADDED
data/lib/dapr.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "dapr/version"
|
data/proto/dapr.proto
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
package dapr;
|
4
|
+
|
5
|
+
import "google/protobuf/any.proto";
|
6
|
+
import "google/protobuf/empty.proto";
|
7
|
+
import "google/protobuf/duration.proto";
|
8
|
+
|
9
|
+
option java_outer_classname = "DaprProtos";
|
10
|
+
option java_package = "io.dapr";
|
11
|
+
|
12
|
+
option csharp_namespace = "Dapr.Client.Autogen.Grpc";
|
13
|
+
|
14
|
+
|
15
|
+
// Dapr definitions
|
16
|
+
service Dapr {
|
17
|
+
rpc PublishEvent(PublishEventEnvelope) returns (google.protobuf.Empty) {}
|
18
|
+
rpc InvokeService(InvokeServiceEnvelope) returns (InvokeServiceResponseEnvelope) {}
|
19
|
+
rpc InvokeBinding(InvokeBindingEnvelope) returns (google.protobuf.Empty) {}
|
20
|
+
rpc GetState(GetStateEnvelope) returns (GetStateResponseEnvelope) {}
|
21
|
+
rpc GetSecret(GetSecretEnvelope) returns (GetSecretResponseEnvelope) {}
|
22
|
+
rpc SaveState(SaveStateEnvelope) returns (google.protobuf.Empty) {}
|
23
|
+
rpc DeleteState(DeleteStateEnvelope) returns (google.protobuf.Empty) {}
|
24
|
+
}
|
25
|
+
|
26
|
+
message InvokeServiceResponseEnvelope {
|
27
|
+
google.protobuf.Any data = 1;
|
28
|
+
map<string,string> metadata = 2;
|
29
|
+
}
|
30
|
+
|
31
|
+
message DeleteStateEnvelope {
|
32
|
+
string storeName = 1;
|
33
|
+
string key = 2;
|
34
|
+
string etag = 3;
|
35
|
+
StateOptions options = 4;
|
36
|
+
}
|
37
|
+
|
38
|
+
message SaveStateEnvelope {
|
39
|
+
string storeName = 1;
|
40
|
+
repeated StateRequest requests = 2;
|
41
|
+
}
|
42
|
+
|
43
|
+
message GetStateEnvelope {
|
44
|
+
string storeName = 1;
|
45
|
+
string key = 2;
|
46
|
+
string consistency = 3;
|
47
|
+
}
|
48
|
+
|
49
|
+
message GetStateResponseEnvelope {
|
50
|
+
google.protobuf.Any data = 1;
|
51
|
+
string etag = 2;
|
52
|
+
}
|
53
|
+
|
54
|
+
message GetSecretEnvelope {
|
55
|
+
string storeName = 1;
|
56
|
+
string key = 2;
|
57
|
+
map<string,string> metadata = 3;
|
58
|
+
}
|
59
|
+
|
60
|
+
message GetSecretResponseEnvelope {
|
61
|
+
map<string,string> data = 1;
|
62
|
+
}
|
63
|
+
|
64
|
+
message InvokeBindingEnvelope {
|
65
|
+
string name = 1;
|
66
|
+
google.protobuf.Any data = 2;
|
67
|
+
map<string,string> metadata = 3;
|
68
|
+
}
|
69
|
+
|
70
|
+
message InvokeServiceEnvelope {
|
71
|
+
string id = 1;
|
72
|
+
string method = 2;
|
73
|
+
google.protobuf.Any data = 3;
|
74
|
+
map<string,string> metadata = 4;
|
75
|
+
}
|
76
|
+
|
77
|
+
message PublishEventEnvelope {
|
78
|
+
string topic = 1;
|
79
|
+
google.protobuf.Any data = 2;
|
80
|
+
}
|
81
|
+
|
82
|
+
message State {
|
83
|
+
string key = 1;
|
84
|
+
google.protobuf.Any value = 2;
|
85
|
+
string etag = 3;
|
86
|
+
map<string,string> metadata = 4;
|
87
|
+
StateOptions options = 5;
|
88
|
+
}
|
89
|
+
|
90
|
+
message StateOptions {
|
91
|
+
string concurrency = 1;
|
92
|
+
string consistency = 2;
|
93
|
+
RetryPolicy retryPolicy = 3;
|
94
|
+
}
|
95
|
+
|
96
|
+
message RetryPolicy {
|
97
|
+
int32 threshold = 1;
|
98
|
+
string pattern = 2;
|
99
|
+
google.protobuf.Duration interval = 3;
|
100
|
+
}
|
101
|
+
|
102
|
+
message StateRequest {
|
103
|
+
string key = 1;
|
104
|
+
google.protobuf.Any value = 2;
|
105
|
+
string etag = 3;
|
106
|
+
map<string,string> metadata = 4;
|
107
|
+
StateOptions options = 5;
|
108
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
package daprclient;
|
4
|
+
|
5
|
+
import "google/protobuf/any.proto";
|
6
|
+
import "google/protobuf/empty.proto";
|
7
|
+
import "google/protobuf/duration.proto";
|
8
|
+
|
9
|
+
option java_outer_classname = "DaprClientProtos";
|
10
|
+
option java_package = "io.dapr";
|
11
|
+
|
12
|
+
// User Code definitions
|
13
|
+
service DaprClient {
|
14
|
+
rpc OnInvoke (InvokeEnvelope) returns (google.protobuf.Any) {}
|
15
|
+
rpc GetTopicSubscriptions(google.protobuf.Empty) returns (GetTopicSubscriptionsEnvelope) {}
|
16
|
+
rpc GetBindingsSubscriptions(google.protobuf.Empty) returns (GetBindingsSubscriptionsEnvelope) {}
|
17
|
+
rpc OnBindingEvent(BindingEventEnvelope) returns (BindingResponseEnvelope) {}
|
18
|
+
rpc OnTopicEvent(CloudEventEnvelope) returns (google.protobuf.Empty) {}
|
19
|
+
}
|
20
|
+
|
21
|
+
message CloudEventEnvelope {
|
22
|
+
string id = 1;
|
23
|
+
string source = 2;
|
24
|
+
string type = 3;
|
25
|
+
string specVersion = 4;
|
26
|
+
string dataContentType = 5;
|
27
|
+
string topic = 6;
|
28
|
+
google.protobuf.Any data = 7;
|
29
|
+
}
|
30
|
+
|
31
|
+
message BindingEventEnvelope {
|
32
|
+
string name = 1;
|
33
|
+
google.protobuf.Any data = 2;
|
34
|
+
map<string,string> metadata = 3;
|
35
|
+
}
|
36
|
+
|
37
|
+
message BindingResponseEnvelope {
|
38
|
+
google.protobuf.Any data = 1;
|
39
|
+
repeated string to = 2;
|
40
|
+
repeated State state = 3;
|
41
|
+
string concurrency = 4;
|
42
|
+
}
|
43
|
+
|
44
|
+
message InvokeEnvelope {
|
45
|
+
string method = 1;
|
46
|
+
google.protobuf.Any data = 2;
|
47
|
+
map<string,string> metadata = 3;
|
48
|
+
}
|
49
|
+
|
50
|
+
message GetTopicSubscriptionsEnvelope {
|
51
|
+
repeated string topics = 1;
|
52
|
+
}
|
53
|
+
|
54
|
+
message GetBindingsSubscriptionsEnvelope {
|
55
|
+
repeated string bindings = 1;
|
56
|
+
}
|
57
|
+
|
58
|
+
message State {
|
59
|
+
string key = 1;
|
60
|
+
google.protobuf.Any value = 2;
|
61
|
+
string etag = 3;
|
62
|
+
map<string,string> metadata = 4;
|
63
|
+
StateOptions options = 5;
|
64
|
+
}
|
65
|
+
|
66
|
+
message StateOptions {
|
67
|
+
string concurrency = 1;
|
68
|
+
string consistency = 2;
|
69
|
+
RetryPolicy retryPolicy = 3;
|
70
|
+
}
|
71
|
+
|
72
|
+
message RetryPolicy {
|
73
|
+
int32 threshold = 1;
|
74
|
+
string pattern = 2;
|
75
|
+
google.protobuf.Duration interval = 3;
|
76
|
+
}
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dapr-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- tjwp
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: google-protobuf
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.17'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.17'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: grpc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: grpc-tools
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 12.3.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 12.3.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
description: Dapr SDK for Ruby
|
98
|
+
email:
|
99
|
+
- tjwp@users.noreply.github.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
108
|
+
- ".travis.yml"
|
109
|
+
- CHANGELOG.md
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/setup
|
117
|
+
- dapr.gemspec
|
118
|
+
- example.rb
|
119
|
+
- lib/dapr-client.rb
|
120
|
+
- lib/dapr.rb
|
121
|
+
- lib/dapr/generated/dapr_pb.rb
|
122
|
+
- lib/dapr/generated/dapr_services_pb.rb
|
123
|
+
- lib/dapr/generated/daprclient_pb.rb
|
124
|
+
- lib/dapr/generated/daprclient_services_pb.rb
|
125
|
+
- lib/dapr/version.rb
|
126
|
+
- proto/dapr.proto
|
127
|
+
- proto/daprclient.proto
|
128
|
+
homepage: https://github.com/tjwp/dapr-ruby-sdk
|
129
|
+
licenses:
|
130
|
+
- MIT
|
131
|
+
metadata:
|
132
|
+
allowed_push_host: https://rubygems.org
|
133
|
+
homepage_uri: https://github.com/tjwp/dapr-ruby-sdk
|
134
|
+
source_code_uri: https://github.com/tjwp/dapr-ruby-sdk
|
135
|
+
changelog_uri: https://github.com/tjwp/dapr-ruby-sdk/CHANGELOG.md
|
136
|
+
github_repo: ssh://github.com/tjwp/dapr-ruby-sdk
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
- lib/dapr/generated
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubygems_version: 3.0.6
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: Dapr SDK for Ruby
|
157
|
+
test_files: []
|