dapr-client 0.1.0 → 0.2.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +3 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.md +22 -5
  6. data/bin/regen_client.sh +15 -0
  7. data/dapr.gemspec +1 -1
  8. data/dapr/proto/common/v1/common.proto +140 -0
  9. data/dapr/proto/runtime/v1/appcallback.proto +131 -0
  10. data/dapr/proto/runtime/v1/dapr.proto +155 -0
  11. data/example.rb +1 -1
  12. data/examples/app-callback/README.md +20 -0
  13. data/examples/app-callback/app_callback_example.rb +15 -0
  14. data/examples/app-callback/app_callback_service.rb +51 -0
  15. data/examples/invoke-simple/README.md +17 -0
  16. data/examples/invoke-simple/invoke-caller.rb +19 -0
  17. data/examples/invoke-simple/invoke-receiver.rb +26 -0
  18. data/examples/pubsub-simple/README.md +13 -0
  19. data/examples/pubsub-simple/publisher.rb +15 -0
  20. data/examples/pubsub-simple/subscriber.rb +28 -0
  21. data/examples/state-store/README.md +7 -0
  22. data/examples/state-store/state-store.rb +29 -0
  23. data/lib/dapr/proto/common/v1/common_pb.rb +87 -0
  24. data/lib/dapr/proto/runtime/v1/appcallback_pb.rb +62 -0
  25. data/lib/dapr/proto/runtime/v1/appcallback_services_pb.rb +49 -0
  26. data/lib/dapr/proto/runtime/v1/dapr_pb.rb +75 -0
  27. data/lib/dapr/proto/runtime/v1/dapr_services_pb.rb +49 -0
  28. data/lib/dapr/version.rb +1 -1
  29. metadata +26 -13
  30. data/lib/dapr/generated/dapr_pb.rb +0 -99
  31. data/lib/dapr/generated/dapr_services_pb.rb +0 -29
  32. data/lib/dapr/generated/daprclient_pb.rb +0 -72
  33. data/lib/dapr/generated/daprclient_services_pb.rb +0 -27
  34. data/proto/dapr.proto +0 -108
  35. data/proto/daprclient.proto +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76432e4fbd3b38d79bd33a4ceaf47da100dd830c622229fc5c8dbedea79e4d8b
4
- data.tar.gz: 33fe1e47295af0fd07278b001fa0c7518b6e7017c23d23ece9f896a87ea377b9
3
+ metadata.gz: 681a7749162ceb3e77996a080c24459c755cd9f29c4f0b27cdb60786cb21f161
4
+ data.tar.gz: 73a5c8fa8873a45efe241052c7867422bf49a1d2bfbb78fe058bd3e4c82350e6
5
5
  SHA512:
6
- metadata.gz: f6c69c223c3c720d4f239d9e9455f48ec86413c39dd94986dba5b33d7474c13e50d0ce3a329bbf35f1680f1c04e991301b8bb45a2732369e4adefcecc4c2b17c
7
- data.tar.gz: 3f0f4b799cc2053bb2016584234f3ebcb2fedd476d3409f021b35a8807087c9a11067e49439a6176db5c86483fab4d5422fc030b0b8013cae4a5a7d0c385f556
6
+ metadata.gz: 3f476fe1b3f24653a39b7d3043baa79e04b9b1fa2f719125fb3bb9a0f61aed0562d01262125ef99267067ef9a15e2f25afc0ee14ceb077ff8a335349c4d33150
7
+ data.tar.gz: 439962d22770b4a002ffcaf9157e2b54d18a7ea3c2c235ba91cffcf4a12c1d5794d84e9fd82d6e6a5a748db41cfef2f8714491e949becf7ec408944972e39e97
@@ -1 +1 @@
1
- 2.5.7
1
+ 2.5.8
@@ -1,4 +1,7 @@
1
1
  # dapr-client
2
2
 
3
+ ## v0.2.0
4
+ - Auto-generated client based on Dapr v0.8.0.
5
+
3
6
  ## v0.1.0 (initial release)
4
7
  - Auto-generated client based on Dapr v0.6.0.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dapr-client (0.1.0)
4
+ dapr-client (0.2.0)
5
5
  google-protobuf
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -28,7 +28,7 @@ Or install it yourself as:
28
28
  A client can be created as follows:
29
29
 
30
30
  ```ruby
31
- require "dapr/generated/dapr_services_pb"
31
+ require "dapr_services_pb"
32
32
 
33
33
  client = Dapr::Dapr::Stub.new('localhost:5001', :this_channel_is_insecure)
34
34
  ```
@@ -45,14 +45,31 @@ dapr run --protocol grpc --grpc-port=50001 ruby example.rb
45
45
 
46
46
  ## Development
47
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.
48
+ ### Setup
49
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).
50
+ After checking out the repo, run `bin/setup` to install dependencies.
51
+ Then, run `rake spec` to run the tests. You can also run `bin/console`
52
+ for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`.
55
+ To release a new version, update the version number in `version.rb`, and then
56
+ run `bundle exec rake release`, which will create a git tag for the version,
57
+ push git commits and tags, and push the `.gem` file to
58
+ [rubygems.org](https://rubygems.org).
59
+
60
+ ### GRPC Client
61
+
62
+ Protobuf definitions are stored in the `dapr/proto` directory of this repo.
63
+
64
+ There is a script, `bin/regen_client.sh`, that can be used to regenerate the Ruby client
65
+ from the protocol definitions. The generated code can be found in `lib/dapr/proto` and is
66
+ added to the lib path.
51
67
 
52
68
  ## Contributing
53
69
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dapr.
70
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tjwp/dapr-ruby-sdk.
55
71
 
56
72
  ## License
57
73
 
58
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
74
+ The gem is available as open source under the terms of the
75
+ [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env zsh
2
+
3
+ bindir="$(dirname "$0")"
4
+
5
+ cd "$bindir/.."
6
+
7
+ echo "Regenerating from protos ... "
8
+ set -ex
9
+
10
+ bundle exec grpc_tools_ruby_protoc -I . --ruby_out=lib --grpc_out=lib dapr/proto/common/v1/common.proto
11
+ bundle exec grpc_tools_ruby_protoc -I . --ruby_out=lib --grpc_out=lib dapr/proto/runtime/v1/dapr.proto
12
+ bundle exec grpc_tools_ruby_protoc -I . --ruby_out=lib --grpc_out=lib dapr/proto/runtime/v1/appcallback.proto
13
+
14
+ set +x
15
+ echo "Done."
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  end
36
36
  spec.bindir = "exe"
37
37
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = ["lib", "lib/dapr/generated"]
38
+ spec.require_paths = ["lib"]
39
39
 
40
40
  spec.add_runtime_dependency "google-protobuf"
41
41
 
@@ -0,0 +1,140 @@
1
+ // ------------------------------------------------------------
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ // ------------------------------------------------------------
5
+
6
+ syntax = "proto3";
7
+
8
+ package dapr.proto.common.v1;
9
+
10
+ import "google/protobuf/any.proto";
11
+ import "google/protobuf/duration.proto";
12
+
13
+ option csharp_namespace = "Dapr.Client.Autogen.Grpc.v1";
14
+ option java_outer_classname = "CommonProtos";
15
+ option java_package = "io.dapr.v1";
16
+ option go_package = "github.com/dapr/dapr/pkg/proto/common/v1;common";
17
+
18
+ // HTTPExtension includes HTTP verb and querystring
19
+ // when Dapr runtime delivers HTTP content.
20
+ //
21
+ // For example, when callers calls http invoke api
22
+ // POST http://localhost:3500/v1.0/invoke/<app_id>/method/<method>?query1=value1&query2=value2
23
+ //
24
+ // Dapr runtime will parse POST as a verb and extract querystring to quersytring map.
25
+ message HTTPExtension {
26
+ // Type of HTTP 1.1 Methods
27
+ // RFC 7231: https://tools.ietf.org/html/rfc7231#page-24
28
+ enum Verb {
29
+ NONE = 0;
30
+ GET = 1;
31
+ HEAD = 2;
32
+ POST = 3;
33
+ PUT = 4;
34
+ DELETE = 5;
35
+ CONNECT = 6;
36
+ OPTIONS = 7;
37
+ TRACE = 8;
38
+ }
39
+
40
+ // Required. HTTP verb.
41
+ Verb verb = 1;
42
+
43
+ // querystring includes HTTP querystring.
44
+ map<string, string> querystring = 2;
45
+ }
46
+
47
+ // InvokeRequest is the message to invoke a method with the data.
48
+ // This message is used in InvokeService of Dapr gRPC Service and OnInvoke
49
+ // of AppCallback gRPC service.
50
+ message InvokeRequest {
51
+ // Required. method is a method name which will be invoked by caller.
52
+ string method = 1;
53
+
54
+ // Required. Bytes value or Protobuf message which caller sent.
55
+ // Dapr treats Any.value as bytes type if Any.type_url is unset.
56
+ google.protobuf.Any data = 2;
57
+
58
+ // The type of data content.
59
+ //
60
+ // This field is required if data delivers http request body
61
+ // Otherwise, this is optional.
62
+ string content_type = 3;
63
+
64
+ // HTTP specific fields if request conveys http-compatible request.
65
+ //
66
+ // This field is required for http-compatible request. Otherwise,
67
+ // this field is optional.
68
+ HTTPExtension http_extension = 4;
69
+ }
70
+
71
+ // InvokeResponse is the response message inclduing data and its content type
72
+ // from app callback.
73
+ // This message is used in InvokeService of Dapr gRPC Service and OnInvoke
74
+ // of AppCallback gRPC service.
75
+ message InvokeResponse {
76
+ // Required. The content body of InvokeService response.
77
+ google.protobuf.Any data = 1;
78
+
79
+ // Required. The type of data content.
80
+ string content_type = 2;
81
+ }
82
+
83
+ // StateItem represents state key, value, and additional options to save state.
84
+ message StateItem {
85
+ // Required. The state key
86
+ string key = 1;
87
+
88
+ // Required. The state data for key
89
+ bytes value = 2;
90
+
91
+ // The entity tag which represents the specific version of data.
92
+ // The exact ETag format is defined by the corresponding data store.
93
+ string etag = 3;
94
+
95
+ // The metadata which will be passed to state store component.
96
+ map<string,string> metadata = 4;
97
+
98
+ // Options for concurrency, consistency, and retry_policy to save the state.
99
+ StateOptions options = 5;
100
+ }
101
+
102
+ // StateOptions configures concurrency, consistency, and retry policy for state operations
103
+ message StateOptions {
104
+ // Enum describing the supported concurrency for state.
105
+ enum StateConcurrency {
106
+ CONCURRENCY_UNSPECIFIED = 0;
107
+ CONCURRENCY_FIRST_WRITE = 1;
108
+ CONCURRENCY_LAST_WRITE = 2;
109
+ }
110
+
111
+ // Enum describing the supported consistency for state.
112
+ enum StateConsistency {
113
+ CONSISTENCY_UNSPECIFIED = 0;
114
+ CONSISTENCY_EVENTUAL = 1;
115
+ CONSISTENCY_STRONG = 2;
116
+ }
117
+
118
+ StateConcurrency concurrency = 1;
119
+ StateConsistency consistency = 2;
120
+ StateRetryPolicy retry_policy = 3;
121
+ }
122
+
123
+ // StateRetryPolicy represents retry policy to set and delete state operations.
124
+ message StateRetryPolicy {
125
+ // Enum describing the support retry pattern
126
+ enum RetryPattern {
127
+ RETRY_UNSPECIFIED = 0;
128
+ RETRY_LINEAR = 1;
129
+ RETRY_EXPONENTIAL = 2;
130
+ }
131
+
132
+ // Maximum number of retries.
133
+ int32 threshold = 1;
134
+
135
+ // Retry pattern.
136
+ RetryPattern pattern = 2;
137
+
138
+ // Initial delay between retries.
139
+ google.protobuf.Duration interval = 3;
140
+ }
@@ -0,0 +1,131 @@
1
+ // ------------------------------------------------------------
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ // ------------------------------------------------------------
5
+
6
+ syntax = "proto3";
7
+
8
+ package dapr.proto.runtime.v1;
9
+
10
+ import "google/protobuf/empty.proto";
11
+ import "dapr/proto/common/v1/common.proto";
12
+
13
+ option csharp_namespace = "Dapr.AppCallback.Autogen.Grpc.v1";
14
+ option java_outer_classname = "DaprAppCallbackProtos";
15
+ option java_package = "io.dapr.v1";
16
+ option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";
17
+
18
+ // AppCallback V1 allows user application to interact with Dapr runtime.
19
+ // User application needs to implement AppCallback service if it needs to
20
+ // receive message from dapr runtime.
21
+ service AppCallback {
22
+ // Invokes service method with InvokeRequest.
23
+ rpc OnInvoke (common.v1.InvokeRequest) returns (common.v1.InvokeResponse) {}
24
+
25
+ // Lists all topics subscribed by this app.
26
+ rpc ListTopicSubscriptions(google.protobuf.Empty) returns (ListTopicSubscriptionsResponse) {}
27
+
28
+ // Subscribes events from Pubsub
29
+ rpc OnTopicEvent(TopicEventRequest) returns (google.protobuf.Empty) {}
30
+
31
+ // Lists all input bindings subscribed by this app.
32
+ rpc ListInputBindings(google.protobuf.Empty) returns (ListInputBindingsResponse) {}
33
+
34
+ // Listens events from the input bindings
35
+ //
36
+ // User application can save the states or send the events to the output
37
+ // bindings optionally by returning BindingEventResponse.
38
+ rpc OnBindingEvent(BindingEventRequest) returns (BindingEventResponse) {}
39
+ }
40
+
41
+ // TopicEventRequest message is compatiable with CloudEvent spec v1.0
42
+ // https://github.com/cloudevents/spec/blob/v1.0/spec.md
43
+ message TopicEventRequest {
44
+ // id identifies the event. Producers MUST ensure that source + id
45
+ // is unique for each distinct event. If a duplicate event is re-sent
46
+ // (e.g. due to a network error) it MAY have the same id.
47
+ string id = 1;
48
+
49
+ // source identifies the context in which an event happened.
50
+ // Often this will include information such as the type of the
51
+ // event source, the organization publishing the event or the process
52
+ // that produced the event. The exact syntax and semantics behind
53
+ // the data encoded in the URI is defined by the event producer.
54
+ string source = 2;
55
+
56
+ // The type of event related to the originating occurrence.
57
+ string type = 3;
58
+
59
+ // The version of the CloudEvents specification.
60
+ string spec_version = 4;
61
+
62
+ // The content type of data value.
63
+ string data_content_type = 5;
64
+
65
+ // The content of the event.
66
+ bytes data = 7;
67
+
68
+ // The pubsub topic which publisher sent to.
69
+ string topic = 6;
70
+ }
71
+
72
+ // BindingEventRequest represents input bindings event.
73
+ message BindingEventRequest {
74
+ // Requried. The name of the input binding component.
75
+ string name = 1;
76
+
77
+ // Required. The payload that the input bindings sent
78
+ bytes data = 2;
79
+
80
+ // The metadata set by the input binging components.
81
+ map<string,string> metadata = 3;
82
+ }
83
+
84
+ // BindingEventResponse includes operations to save state or
85
+ // send data to output bindings optionally.
86
+ message BindingEventResponse {
87
+ // The name of state store where states are saved.
88
+ string store_name = 1;
89
+
90
+ // The state key values which will be stored in store_name.
91
+ repeated common.v1.StateItem states = 2;
92
+
93
+ // BindingEventConcurrency is the kind of concurrency
94
+ enum BindingEventConcurrency {
95
+ // SEQUENTIAL sends data to output bindings specified in "to" sequentially.
96
+ SEQUENTIAL = 0;
97
+ // PARALLEL sends data to output bindings specified in "to" in parallel.
98
+ PARALLEL = 1;
99
+ }
100
+
101
+ // The list of output bindings.
102
+ repeated string to = 3;
103
+
104
+ // The content which will be sent to "to" output bindings.
105
+ bytes data = 4;
106
+
107
+ // The concurrency of output bindings to send data to
108
+ // "to" output bindings list. The default is SEQUENTIAL.
109
+ BindingEventConcurrency concurrency = 5;
110
+ }
111
+
112
+ // ListTopicSubscriptionsResponse is the message including the list of the subscribing topics.
113
+ message ListTopicSubscriptionsResponse {
114
+ // The list of topics.
115
+ repeated TopicSubscription subscriptions = 1;
116
+ }
117
+
118
+ // TopicSubscription represents topic and metadata.
119
+ message TopicSubscription {
120
+ // Required. The name of topic which will be subscribed
121
+ string topic = 1;
122
+
123
+ // The optional properties used for this topic's subscribtion e.g. session id
124
+ map<string,string> metadata = 2;
125
+ }
126
+
127
+ // ListInputBindingsResponse is the message including the list of input bindings.
128
+ message ListInputBindingsResponse {
129
+ // The list of input bindings.
130
+ repeated string bindings = 1;
131
+ }
@@ -0,0 +1,155 @@
1
+ // ------------------------------------------------------------
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ // ------------------------------------------------------------
5
+
6
+ syntax = "proto3";
7
+
8
+ package dapr.proto.runtime.v1;
9
+
10
+ import "google/protobuf/empty.proto";
11
+ import "dapr/proto/common/v1/common.proto";
12
+
13
+ option csharp_namespace = "Dapr.Client.Autogen.Grpc.v1";
14
+ option java_outer_classname = "DaprProtos";
15
+ option java_package = "io.dapr.v1";
16
+ option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";
17
+
18
+ // Dapr service provides APIs to user application to access Dapr building blocks.
19
+ service Dapr {
20
+ // Invokes a method on a remote Dapr app.
21
+ rpc InvokeService(InvokeServiceRequest) returns (common.v1.InvokeResponse) {}
22
+
23
+ // Gets the state for a specific key.
24
+ rpc GetState(GetStateRequest) returns (GetStateResponse) {}
25
+
26
+ // Saves the state for a specific key.
27
+ rpc SaveState(SaveStateRequest) returns (google.protobuf.Empty) {}
28
+
29
+ // Deletes the state for a specific key.
30
+ rpc DeleteState(DeleteStateRequest) returns (google.protobuf.Empty) {}
31
+
32
+ // Publishes events to the specific topic.
33
+ rpc PublishEvent(PublishEventRequest) returns (google.protobuf.Empty) {}
34
+
35
+ // Invokes binding data to specific output bindings
36
+ rpc InvokeBinding(InvokeBindingRequest) returns (InvokeBindingResponse) {}
37
+
38
+ // Gets secrets from secret stores.
39
+ rpc GetSecret(GetSecretRequest) returns (GetSecretResponse) {}
40
+ }
41
+
42
+ // InvokeServiceRequest represents the request message for Service invocation.
43
+ message InvokeServiceRequest {
44
+ // Required. Callee's app id.
45
+ string id = 1;
46
+
47
+ // Required. message which will be delivered to callee.
48
+ common.v1.InvokeRequest message = 3;
49
+ }
50
+
51
+ // GetStateRequest is the message to get key-value states from specific state store.
52
+ message GetStateRequest {
53
+ // The name of state store.
54
+ string store_name = 1;
55
+
56
+ // The key of the desired state
57
+ string key = 2;
58
+
59
+ // The read consistency of the state store.
60
+ common.v1.StateOptions.StateConsistency consistency = 3;
61
+ }
62
+
63
+ // GetStateResponse is the response conveying the state value and etag.
64
+ message GetStateResponse {
65
+ // The byte array data
66
+ bytes data = 1;
67
+
68
+ // The entity tag which represents the specific version of data.
69
+ // ETag format is defined by the corresponding data store.
70
+ string etag = 2;
71
+ }
72
+
73
+ // DeleteStateRequest is the message to delete key-value states in the specific state store.
74
+ message DeleteStateRequest {
75
+ // The name of state store.
76
+ string store_name = 1;
77
+
78
+ // The key of the desired state
79
+ string key = 2;
80
+
81
+ // The entity tag which represents the specific version of data.
82
+ // The exact ETag format is defined by the corresponding data store.
83
+ string etag = 3;
84
+
85
+ // State operation options which includes concurrency/
86
+ // consistency/retry_policy.
87
+ common.v1.StateOptions options = 4;
88
+ }
89
+
90
+ // SaveStateRequest is the message to save multiple states into state store.
91
+ message SaveStateRequest {
92
+ // The name of state store.
93
+ string store_name = 1;
94
+
95
+ // The array of the state key values.
96
+ repeated common.v1.StateItem states = 2;
97
+ }
98
+
99
+ // PublishEventRequest is the message to publish event data to pubsub topic
100
+ message PublishEventRequest {
101
+ // The pubsub topic
102
+ string topic = 1;
103
+
104
+ // The data which will be published to topic.
105
+ bytes data = 2;
106
+ }
107
+
108
+ // InvokeBindingRequest is the message to send data to output bindings
109
+ message InvokeBindingRequest {
110
+ // The name of the output binding to invoke.
111
+ string name = 1;
112
+
113
+ // The data which will be sent to output binding.
114
+ bytes data = 2;
115
+
116
+ // The metadata passing to output binding components
117
+ //
118
+ // Common metadata property:
119
+ // - ttlInSeconds : the time to live in seconds for the message.
120
+ // If set in the binding definition will cause all messages to
121
+ // have a default time to live. The message ttl overrides any value
122
+ // in the binding definition.
123
+ map<string,string> metadata = 3;
124
+
125
+ // The name of the operation type for the binding to invoke
126
+ string operation = 4;
127
+ }
128
+
129
+ // InvokeBindingResponse is the message returned from an output binding invocation
130
+ message InvokeBindingResponse {
131
+ // The data which will be sent to output binding.
132
+ bytes data = 1;
133
+
134
+ // The metadata returned from an external system
135
+ map<string,string> metadata = 2;
136
+ }
137
+
138
+ // GetSecretRequest is the message to get secret from secret store.
139
+ message GetSecretRequest {
140
+ // The name of secret store.
141
+ string store_name = 1;
142
+
143
+ // The name of secret key.
144
+ string key = 2;
145
+
146
+ // The metadata which will be sent to secret store components.
147
+ map<string,string> metadata = 3;
148
+ }
149
+
150
+ // GetSecretResponse is the response mesage to convey the requested secret.
151
+ message GetSecretResponse {
152
+ // data is the secret value. Some secret store, such as kubernetes secret
153
+ // store, can save multiple secrets for single secret key.
154
+ map<string, string> data = 1;
155
+ }