momento 0.1.0 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +3 -0
- data/.rubocop.yml +26 -1
- data/.ruby-version +1 -1
- data/.yardopts +2 -0
- data/CHANGELOG.md +119 -0
- data/CONTRIBUTING.md +6 -7
- data/Gemfile +1 -6
- data/Gemfile.lock +34 -24
- data/README.md +143 -38
- data/README.template.md +93 -0
- data/examples/.gitignore +1 -0
- data/examples/Gemfile +5 -0
- data/examples/README.md +34 -0
- data/examples/compact.rb +47 -0
- data/examples/example.rb +72 -0
- data/examples/file.rb +58 -0
- data/lib/README-generating-pb.txt +1 -1
- data/lib/momento/auth/credential_provider.rb +78 -0
- data/lib/momento/cache_client.rb +457 -0
- data/lib/momento/collection_ttl.rb +79 -0
- data/lib/momento/config/configuration.rb +16 -0
- data/lib/momento/config/configurations.rb +17 -0
- data/lib/momento/config/transport/grpc_configuration.rb +25 -0
- data/lib/momento/config/transport/static_transport_strategy.rb +12 -0
- data/lib/momento/config/transport/transport_strategy.rb +16 -0
- data/lib/momento/error/grpc_details.rb +38 -0
- data/lib/momento/error/transport_details.rb +20 -0
- data/lib/momento/error/types.rb +247 -0
- data/lib/momento/error.rb +54 -0
- data/lib/momento/error_builder.rb +50 -0
- data/lib/momento/exceptions.rb +7 -0
- data/lib/momento/generated/README.md +16 -0
- data/lib/momento/generated/auth_pb.rb +52 -0
- data/lib/momento/generated/auth_services_pb.rb +27 -0
- data/lib/momento/generated/cacheclient_pb.rb +203 -0
- data/lib/momento/generated/cacheclient_services_pb.rb +90 -0
- data/lib/momento/generated/cacheping_pb.rb +38 -0
- data/lib/momento/generated/cacheping_services_pb.rb +23 -0
- data/lib/momento/generated/cachepubsub_pb.rb +48 -0
- data/lib/momento/generated/cachepubsub_services_pb.rb +56 -0
- data/lib/momento/generated/common_pb.rb +44 -0
- data/lib/momento/generated/controlclient_pb.rb +72 -0
- data/lib/momento/generated/controlclient_services_pb.rb +35 -0
- data/lib/momento/generated/extensions_pb.rb +35 -0
- data/lib/momento/generated/generate_protos.sh +47 -0
- data/lib/momento/generated/leaderboard_pb.rb +56 -0
- data/lib/momento/generated/leaderboard_services_pb.rb +57 -0
- data/lib/momento/generated/permissionmessages_pb.rb +48 -0
- data/lib/momento/generated/token_pb.rb +43 -0
- data/lib/momento/generated/token_services_pb.rb +23 -0
- data/lib/momento/generated/webhook_pb.rb +49 -0
- data/lib/momento/generated/webhook_services_pb.rb +32 -0
- data/lib/momento/{create_cache_response.rb → response/control/create_cache_response.rb} +33 -24
- data/lib/momento/{delete_cache_response.rb → response/control/delete_cache_response.rb} +28 -21
- data/lib/momento/response/control/list_caches_response.rb +80 -0
- data/lib/momento/response/delete_response.rb +45 -0
- data/lib/momento/response/error.rb +10 -3
- data/lib/momento/response/get_response.rb +107 -0
- data/lib/momento/response/response.rb +67 -0
- data/lib/momento/response/response_builder.rb +18 -0
- data/lib/momento/response/set_response.rb +59 -0
- data/lib/momento/response/sort_order.rb +11 -0
- data/lib/momento/response/sorted_set/sorted_set_fetch_response.rb +107 -0
- data/lib/momento/response/sorted_set/sorted_set_put_element_response.rb +44 -0
- data/lib/momento/response/sorted_set/sorted_set_put_elements_response.rb +44 -0
- data/lib/momento/ttl.rb +48 -0
- data/lib/momento/version.rb +2 -1
- data/lib/momento.rb +6 -1
- data/momento.gemspec +6 -3
- data/release-please-config.json +15 -0
- data/sig/momento/auth/credential_provider.rbs +11 -0
- data/sig/momento/cache_client.rbs +12 -0
- data/sig/momento/collection_ttl.rbs +22 -0
- data/sig/momento/config/configuration.rbs +9 -0
- data/sig/momento/config/configurations.rbs +9 -0
- data/sig/momento/config/transport/grpc_configuration.rbs +7 -0
- data/sig/momento/config/transport/transport_strategy.rbs +7 -0
- data/sig/momento/list_caches_response.rbs +7 -0
- data/sig/momento/sorted_set_fetch_response.rbs +13 -0
- data/sig/momento/sorted_set_put_element_response.rbs +5 -0
- data/sig/momento/sorted_set_put_elements_response.rbs +5 -0
- metadata +127 -28
- data/examples/basic.rb +0 -45
- data/lib/momento/cacheclient_pb.rb +0 -332
- data/lib/momento/cacheclient_services_pb.rb +0 -42
- data/lib/momento/controlclient_pb.rb +0 -71
- data/lib/momento/controlclient_services_pb.rb +0 -29
- data/lib/momento/delete_response.rb +0 -33
- data/lib/momento/get_response.rb +0 -80
- data/lib/momento/list_caches_response.rb +0 -53
- data/lib/momento/response.rb +0 -17
- data/lib/momento/set_response.rb +0 -39
- data/lib/momento/simple_cache_client.rb +0 -204
@@ -0,0 +1,247 @@
|
|
1
|
+
module Momento
|
2
|
+
module Error
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
|
5
|
+
# A cache with the specified name already exists.
|
6
|
+
class AlreadyExistsError < RuntimeError
|
7
|
+
include Momento::Error
|
8
|
+
|
9
|
+
# (see Momento::Error#error_code)
|
10
|
+
def error_code
|
11
|
+
:ALREADY_EXISTS_ERROR
|
12
|
+
end
|
13
|
+
|
14
|
+
# (see Momento::Error#message)
|
15
|
+
def message
|
16
|
+
"A cache with the specified name already exists. To resolve this error, either delete the existing cache and make a new one, or use a different name. Cache name: '#{context[:cache_name]}'"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Invalid authentication credentials to connect to cache service
|
21
|
+
class AuthenticationError < RuntimeError
|
22
|
+
include Momento::Error
|
23
|
+
|
24
|
+
# (see Momento::Error#error_code)
|
25
|
+
def error_code
|
26
|
+
:AUTHENTICATION_ERROR
|
27
|
+
end
|
28
|
+
|
29
|
+
# (see Momento::Error#message)
|
30
|
+
def message
|
31
|
+
"Invalid authentication credentials to connect to cache service: #{details}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# The request was invalid.
|
36
|
+
class BadRequestError < RuntimeError
|
37
|
+
include Momento::Error
|
38
|
+
|
39
|
+
# (see Momento::Error#error_code)
|
40
|
+
def error_code
|
41
|
+
:BAD_REQUEST_ERROR
|
42
|
+
end
|
43
|
+
|
44
|
+
# (see Momento::Error#message)
|
45
|
+
def message
|
46
|
+
"The request was invalid; please contact Momento: #{details}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# The request was cancelled by the server.
|
51
|
+
class CancelledError < RuntimeError
|
52
|
+
include Momento::Error
|
53
|
+
|
54
|
+
# (see Momento::Error#error_code)
|
55
|
+
def error_code
|
56
|
+
:CANCELLED_ERROR
|
57
|
+
end
|
58
|
+
|
59
|
+
# (see Momento::Error#message)
|
60
|
+
def message
|
61
|
+
"The request was cancelled by the server; please contact Momento: #{details}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# A client resource (most likely memory) was exhausted.
|
66
|
+
class ClientResourceExhaustedError < RuntimeError
|
67
|
+
include Momento::Error
|
68
|
+
|
69
|
+
# (see Momento::Error#error_code)
|
70
|
+
def error_code
|
71
|
+
:CLIENT_RESOURCE_EXHAUSTED
|
72
|
+
end
|
73
|
+
|
74
|
+
# (see Momento::Error#message)
|
75
|
+
def message
|
76
|
+
"A client resource (most likely memory) was exhausted. If you are executing a high volume of concurrent requests or using very large object sizes, your Configuration may need to be updated to allocate more memory. Please contact Momento for assistance."
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Error connecting to Momento servers.
|
81
|
+
class ConnectionError < RuntimeError
|
82
|
+
include Momento::Error
|
83
|
+
|
84
|
+
# (see Momento::Error#error_code)
|
85
|
+
def error_code
|
86
|
+
:CONNECTION_ERROR
|
87
|
+
end
|
88
|
+
|
89
|
+
# (see Momento::Error#message)
|
90
|
+
def message
|
91
|
+
"Error connecting to Momento servers."
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# System is not in a state required for the operation\'s execution
|
96
|
+
class FailedPreconditionError < RuntimeError
|
97
|
+
include Momento::Error
|
98
|
+
|
99
|
+
# (see Momento::Error#error_code)
|
100
|
+
def error_code
|
101
|
+
:FAILED_PRECONDITION_ERROR
|
102
|
+
end
|
103
|
+
|
104
|
+
# (see Momento::Error#message)
|
105
|
+
def message
|
106
|
+
"System is not in a state required for the operation's execution"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# An unexpected error occurred while trying to fulfill the request.
|
111
|
+
class InternalServerError < RuntimeError
|
112
|
+
include Momento::Error
|
113
|
+
|
114
|
+
# (see Momento::Error#error_code)
|
115
|
+
def error_code
|
116
|
+
:INTERNAL_SERVER_ERROR
|
117
|
+
end
|
118
|
+
|
119
|
+
# (see Momento::Error#message)
|
120
|
+
def message
|
121
|
+
"An unexpected error occurred while trying to fulfill the request; please contact Momento: #{details}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Invalid argument passed to Momento client
|
126
|
+
class InvalidArgumentError < ArgumentError
|
127
|
+
include Momento::Error
|
128
|
+
|
129
|
+
# (see Momento::Error#error_code)
|
130
|
+
def error_code
|
131
|
+
:INVALID_ARGUMENT_ERROR
|
132
|
+
end
|
133
|
+
|
134
|
+
# (see Momento::Error#message)
|
135
|
+
def message
|
136
|
+
"Invalid argument passed to Momento client: #{details}"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Request rate exceeded the limits for this account.
|
141
|
+
class LimitExceededError < RuntimeError
|
142
|
+
include Momento::Error
|
143
|
+
|
144
|
+
# (see Momento::Error#error_code)
|
145
|
+
def error_code
|
146
|
+
:LIMIT_EXCEEDED_ERROR
|
147
|
+
end
|
148
|
+
|
149
|
+
# (see Momento::Error#message)
|
150
|
+
def message
|
151
|
+
"Request rate exceeded the limits for this account. To resolve this error, reduce your request rate, or contact Momento to request a limit increase."
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# A cache with the specified name does not exist.
|
156
|
+
class NotFoundError < RuntimeError
|
157
|
+
include Momento::Error
|
158
|
+
|
159
|
+
# (see Momento::Error#error_code)
|
160
|
+
def error_code
|
161
|
+
:NOT_FOUND_ERROR
|
162
|
+
end
|
163
|
+
|
164
|
+
# (see Momento::Error#message)
|
165
|
+
def message
|
166
|
+
"A cache with the specified name does not exist. To resolve this error, make sure you have created the cache before attempting to use it. Cache name: '#{context[:cache_name]}'"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Insufficient permissions to perform an operation on a cache.
|
171
|
+
class PermissionError < RuntimeError
|
172
|
+
include Momento::Error
|
173
|
+
|
174
|
+
# (see Momento::Error#error_code)
|
175
|
+
def error_code
|
176
|
+
:PERMISSION_ERROR
|
177
|
+
end
|
178
|
+
|
179
|
+
# (see Momento::Error#message)
|
180
|
+
def message
|
181
|
+
"Insufficient permissions to perform an operation on a cache: #{details}"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# The server was unable to handle the request
|
186
|
+
class ServerUnavailableError < RuntimeError
|
187
|
+
include Momento::Error
|
188
|
+
|
189
|
+
# (see Momento::Error#error_code)
|
190
|
+
def error_code
|
191
|
+
:SERVER_UNAVAILABLE
|
192
|
+
end
|
193
|
+
|
194
|
+
# (see Momento::Error#message)
|
195
|
+
def message
|
196
|
+
"The server was unable to handle the request; consider retrying. If the error persists, please contact Momento."
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# The client's configured timeout was exceeded.
|
201
|
+
class TimeoutError < RuntimeError
|
202
|
+
include Momento::Error
|
203
|
+
|
204
|
+
# (see Momento::Error#error_code)
|
205
|
+
def error_code
|
206
|
+
:TIMEOUT_ERROR
|
207
|
+
end
|
208
|
+
|
209
|
+
# (see Momento::Error#message)
|
210
|
+
def message
|
211
|
+
"The client's configured timeout was exceeded; you may need to use a Configuration with more lenient timeouts. Timeout value: #{context[:timeout]}"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# The cache service failed due to an internal error
|
216
|
+
class UnknownError < RuntimeError
|
217
|
+
include Momento::Error
|
218
|
+
|
219
|
+
# (see Momento::Error#error_code)
|
220
|
+
def error_code
|
221
|
+
:UNKNOWN_ERROR
|
222
|
+
end
|
223
|
+
|
224
|
+
# (see Momento::Error#message)
|
225
|
+
def message
|
226
|
+
"CacheService failed due to an internal error"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
# The cache service failed due to an internal error
|
231
|
+
class UnknownServiceError < RuntimeError
|
232
|
+
include Momento::Error
|
233
|
+
|
234
|
+
# (see Momento::Error#error_code)
|
235
|
+
def error_code
|
236
|
+
:UNKNOWN_SERVICE_ERROR
|
237
|
+
end
|
238
|
+
|
239
|
+
# (see Momento::Error#message)
|
240
|
+
def message
|
241
|
+
"The service returned an unknown response; please contact Momento: #{details}"
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# rubocop:enable Layout/LineLength
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative 'error/types'
|
2
|
+
|
3
|
+
module Momento
|
4
|
+
# Errors from the Momento client or service, available as `response.error`.
|
5
|
+
#
|
6
|
+
# Momento::Errors are Exceptions. They can be raised. If the error was
|
7
|
+
# caused by an exception, it will be available in {#cause}.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# # This is a contrived example to show what you can do with a Momento::Error.
|
11
|
+
# response = client.cache_name(cache_name, key)
|
12
|
+
# if response.error?
|
13
|
+
# error = response.error
|
14
|
+
#
|
15
|
+
# puts "Creating the cache failed: #{error}"
|
16
|
+
# puts "The cause was #{error.cause}"
|
17
|
+
# puts "The details of the error are #{error.details}"
|
18
|
+
# puts "The error code is #{error.error_code}"
|
19
|
+
#
|
20
|
+
# case error
|
21
|
+
# when Momento::Error::LimitExceededError
|
22
|
+
# puts "We'll have to slow down"
|
23
|
+
# when Momento::Error::PermissionError
|
24
|
+
# puts "We'll have to fix our auth token"
|
25
|
+
# when Momento::Error::InvalidArgumentError
|
26
|
+
# puts "We can't make a cache named #{cache_name}"
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# raise error
|
30
|
+
# end
|
31
|
+
module Error
|
32
|
+
# @return [Exception] the original exception which was the cause of the error
|
33
|
+
attr_accessor :cause
|
34
|
+
# @return [Hash] any context relevant to the error such as method arguments
|
35
|
+
attr_accessor :context
|
36
|
+
# @return [Momento::Error::TransportDetails] details about the transport layer
|
37
|
+
attr_accessor :transport_details
|
38
|
+
# @return [String] details about the error
|
39
|
+
attr_accessor :details
|
40
|
+
|
41
|
+
# @!method error_code
|
42
|
+
# A Momento-specific code for the type of error.
|
43
|
+
# @return [Symbol]
|
44
|
+
|
45
|
+
# @!method message
|
46
|
+
# The error message.
|
47
|
+
# @return [String]
|
48
|
+
|
49
|
+
# (see #message)
|
50
|
+
def to_s
|
51
|
+
message
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'grpc'
|
2
|
+
require_relative 'error/types'
|
3
|
+
require_relative 'exceptions'
|
4
|
+
|
5
|
+
module Momento
|
6
|
+
# @private
|
7
|
+
class ErrorBuilder
|
8
|
+
EXCEPTION_MAP = {
|
9
|
+
GRPC::Aborted => Error::InternalServerError,
|
10
|
+
GRPC::AlreadyExists => Error::AlreadyExistsError,
|
11
|
+
GRPC::Cancelled => Error::CancelledError,
|
12
|
+
GRPC::DataLoss => Error::InternalServerError,
|
13
|
+
GRPC::DeadlineExceeded => Error::TimeoutError,
|
14
|
+
GRPC::FailedPrecondition => Error::FailedPreconditionError,
|
15
|
+
GRPC::Internal => Error::InternalServerError,
|
16
|
+
GRPC::InvalidArgument => Error::InvalidArgumentError,
|
17
|
+
GRPC::NotFound => Error::NotFoundError,
|
18
|
+
GRPC::OutOfRange => Error::BadRequestError,
|
19
|
+
GRPC::PermissionDenied => Error::PermissionError,
|
20
|
+
GRPC::ResourceExhausted => Error::LimitExceededError,
|
21
|
+
GRPC::Unauthenticated => Error::AuthenticationError,
|
22
|
+
GRPC::Unavailable => Error::ServerUnavailableError,
|
23
|
+
GRPC::Unimplemented => Error::BadRequestError,
|
24
|
+
GRPC::Unknown => Error::UnknownServiceError,
|
25
|
+
Momento::CacheNameError => Error::InvalidArgumentError
|
26
|
+
}.freeze
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def from_exception(exception, context: {})
|
30
|
+
error_class = EXCEPTION_MAP[exception.class] || Error::UnknownError
|
31
|
+
|
32
|
+
error = error_class.new
|
33
|
+
error.context = context
|
34
|
+
error.cause = exception
|
35
|
+
|
36
|
+
case exception
|
37
|
+
when GRPC::BadStatus
|
38
|
+
error.transport_details = Error::TransportDetails.new(grpc: exception)
|
39
|
+
error.details = exception.details
|
40
|
+
else
|
41
|
+
error.details = exception.message
|
42
|
+
end
|
43
|
+
|
44
|
+
error.freeze
|
45
|
+
|
46
|
+
return error
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Generate proto code
|
2
|
+
|
3
|
+
1. Change into this directory, specify the path to the protos directory in the bash script, then run it:
|
4
|
+
|
5
|
+
```
|
6
|
+
cd path/to/client-sdk-ruby/lib/momento/generated/
|
7
|
+
export PROTO_PATH="path/to/client-protos/proto/"
|
8
|
+
./generate_protos.sh
|
9
|
+
```
|
10
|
+
|
11
|
+
2. Verify unit tests still pass by going back to the top-level directory and running `rspec`:
|
12
|
+
|
13
|
+
```
|
14
|
+
cd ../../..
|
15
|
+
rspec
|
16
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
+
# source: auth.proto
|
5
|
+
|
6
|
+
require 'google/protobuf'
|
7
|
+
|
8
|
+
require_relative 'permissionmessages_pb'
|
9
|
+
|
10
|
+
descriptor_data = "\n\nauth.proto\x12\x04\x61uth\x1a\x18permissionmessages.proto\"\x0f\n\r_LoginRequest\"\xfc\x02\n\x0e_LoginResponse\x12<\n\x0e\x64irect_browser\x18\x01 \x01(\x0b\x32\".auth._LoginResponse.DirectBrowserH\x00\x12\x32\n\tlogged_in\x18\x02 \x01(\x0b\x32\x1d.auth._LoginResponse.LoggedInH\x00\x12/\n\x07message\x18\x03 \x01(\x0b\x32\x1c.auth._LoginResponse.MessageH\x00\x12+\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x1a.auth._LoginResponse.ErrorH\x00\x1a<\n\x08LoggedIn\x12\x15\n\rsession_token\x18\x01 \x01(\t\x12\x19\n\x11valid_for_seconds\x18\x02 \x01(\r\x1a\x1c\n\x05\x45rror\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x1a\x1c\n\rDirectBrowser\x12\x0b\n\x03url\x18\x01 \x01(\t\x1a\x17\n\x07Message\x12\x0c\n\x04text\x18\x01 \x01(\tB\x07\n\x05state\"\xb7\x02\n\x18_GenerateApiTokenRequest\x12\x35\n\x05never\x18\x01 \x01(\x0b\x32$.auth._GenerateApiTokenRequest.NeverH\x00\x12\x39\n\x07\x65xpires\x18\x02 \x01(\x0b\x32&.auth._GenerateApiTokenRequest.ExpiresH\x00\x12\x12\n\nauth_token\x18\x03 \x01(\t\x12\x35\n\x0bpermissions\x18\x04 \x01(\x0b\x32 .permission_messages.Permissions\x12\x10\n\x08token_id\x18\x05 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x06 \x01(\t\x1a\x07\n\x05Never\x1a$\n\x07\x45xpires\x12\x19\n\x11valid_for_seconds\x18\x01 \x01(\rB\x08\n\x06\x65xpiry\"j\n\x19_GenerateApiTokenResponse\x12\x0f\n\x07\x61pi_key\x18\x01 \x01(\t\x12\x15\n\rrefresh_token\x18\x02 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x03 \x01(\t\x12\x13\n\x0bvalid_until\x18\x04 \x01(\x04\"A\n\x17_RefreshApiTokenRequest\x12\x0f\n\x07\x61pi_key\x18\x01 \x01(\t\x12\x15\n\rrefresh_token\x18\x02 \x01(\t\"i\n\x18_RefreshApiTokenResponse\x12\x0f\n\x07\x61pi_key\x18\x01 \x01(\t\x12\x15\n\rrefresh_token\x18\x02 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x03 \x01(\t\x12\x13\n\x0bvalid_until\x18\x04 \x01(\x04\x32\xe9\x01\n\x04\x41uth\x12\x36\n\x05Login\x12\x13.auth._LoginRequest\x1a\x14.auth._LoginResponse\"\x00\x30\x01\x12U\n\x10GenerateApiToken\x12\x1e.auth._GenerateApiTokenRequest\x1a\x1f.auth._GenerateApiTokenResponse\"\x00\x12R\n\x0fRefreshApiToken\x12\x1d.auth._RefreshApiTokenRequest\x1a\x1e.auth._RefreshApiTokenResponse\"\x00\x42\x42\n\x0cmomento.authP\x01Z0github.com/momentohq/client-sdk-go;client_sdk_gob\x06proto3"
|
11
|
+
|
12
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
13
|
+
|
14
|
+
begin
|
15
|
+
pool.add_serialized_file(descriptor_data)
|
16
|
+
rescue TypeError
|
17
|
+
# Compatibility code: will be removed in the next major version.
|
18
|
+
require_relative 'google/protobuf/descriptor_pb'
|
19
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
20
|
+
parsed.clear_dependency
|
21
|
+
serialized = parsed.class.encode(parsed)
|
22
|
+
file = pool.add_serialized_file(serialized)
|
23
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
24
|
+
imports = [
|
25
|
+
["permission_messages.Permissions", "permissionmessages.proto"]
|
26
|
+
]
|
27
|
+
imports.each do |type_name, expected_filename|
|
28
|
+
import_file = pool.lookup(type_name).file_descriptor
|
29
|
+
if import_file.name != expected_filename
|
30
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
34
|
+
warn "This will become an error in the next major version."
|
35
|
+
end
|
36
|
+
|
37
|
+
module MomentoProtos
|
38
|
+
module Auth
|
39
|
+
PB__LoginRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._LoginRequest").msgclass
|
40
|
+
PB__LoginResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._LoginResponse").msgclass
|
41
|
+
PB__LoginResponse::LoggedIn = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._LoginResponse.LoggedIn").msgclass
|
42
|
+
PB__LoginResponse::Error = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._LoginResponse.Error").msgclass
|
43
|
+
PB__LoginResponse::DirectBrowser = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._LoginResponse.DirectBrowser").msgclass
|
44
|
+
PB__LoginResponse::Message = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._LoginResponse.Message").msgclass
|
45
|
+
PB__GenerateApiTokenRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._GenerateApiTokenRequest").msgclass
|
46
|
+
PB__GenerateApiTokenRequest::Never = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._GenerateApiTokenRequest.Never").msgclass
|
47
|
+
PB__GenerateApiTokenRequest::Expires = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._GenerateApiTokenRequest.Expires").msgclass
|
48
|
+
PB__GenerateApiTokenResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._GenerateApiTokenResponse").msgclass
|
49
|
+
PB__RefreshApiTokenRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._RefreshApiTokenRequest").msgclass
|
50
|
+
PB__RefreshApiTokenResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("auth._RefreshApiTokenResponse").msgclass
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: auth.proto for package 'auth'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'auth_pb'
|
6
|
+
|
7
|
+
module MomentoProtos
|
8
|
+
module Auth
|
9
|
+
module Auth
|
10
|
+
class Service
|
11
|
+
include ::GRPC::GenericService
|
12
|
+
|
13
|
+
self.marshal_class_method = :encode
|
14
|
+
self.unmarshal_class_method = :decode
|
15
|
+
self.service_name = 'auth.Auth'
|
16
|
+
|
17
|
+
rpc :Login, ::Auth::PB__LoginRequest, stream(::Auth::PB__LoginResponse)
|
18
|
+
# api for initially generating api and refresh tokens
|
19
|
+
rpc :GenerateApiToken, ::Auth::PB__GenerateApiTokenRequest, ::Auth::PB__GenerateApiTokenResponse
|
20
|
+
# api for programmatically refreshing api and refresh tokens
|
21
|
+
rpc :RefreshApiToken, ::Auth::PB__RefreshApiTokenRequest, ::Auth::PB__RefreshApiTokenResponse
|
22
|
+
end
|
23
|
+
|
24
|
+
Stub = Service.rpc_stub_class
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|