hatchet-sdk 0.9.0 → 0.11.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/lib/hatchet/clients/grpc/admin.rb +20 -0
  4. data/lib/hatchet/clients/grpc/dispatcher.rb +6 -2
  5. data/lib/hatchet/clients/rest/.openapi-generator/FILES +13 -0
  6. data/lib/hatchet/clients/rest/README.md +21 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/serverless_api.rb +405 -0
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/streams_api.rb +263 -0
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +71 -0
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +142 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rate_limit.rb +14 -4
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_entitlements.rb +367 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_serverless_endpoint_request.rb +411 -0
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint.rb +556 -0
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint_kind.rb +40 -0
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint_list.rb +231 -0
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_serverless_endpoint_status.rb +271 -0
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_stream_payload_ref.rb +238 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_stream_topic.rb +343 -0
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_stream_topic_list.rb +292 -0
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_serverless_endpoint_request.rb +354 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_count.rb +238 -0
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +14 -4
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +13 -0
  25. data/lib/hatchet/context.rb +13 -0
  26. data/lib/hatchet/contracts/dispatcher/dispatcher_pb.rb +1 -1
  27. data/lib/hatchet/contracts/workflows/workflows_pb.rb +3 -1
  28. data/lib/hatchet/contracts/workflows/workflows_services_pb.rb +1 -0
  29. data/lib/hatchet/engine_version.rb +1 -0
  30. data/lib/hatchet/exceptions.rb +18 -0
  31. data/lib/hatchet/features/rate_limits.rb +13 -0
  32. data/lib/hatchet/version.rb +1 -1
  33. data/lib/hatchet/worker/runner.rb +24 -2
  34. data/sig/hatchet/clients/grpc/admin.rbs +1 -0
  35. data/sig/hatchet/context.rbs +1 -0
  36. data/sig/hatchet/features/rate_limits.rbs +1 -0
  37. metadata +15 -2
@@ -0,0 +1,411 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class V1CreateServerlessEndpointRequest
18
+ # The name of the endpoint. Unique within the tenant.
19
+ attr_accessor :name
20
+
21
+ # The HTTPS URL (port 443) polled periodically to discover the workflows this endpoint serves.
22
+ attr_accessor :healthcheck_url
23
+
24
+ # The HTTPS URL (port 443) that assigned tasks are delivered to.
25
+ attr_accessor :trigger_url
26
+
27
+ # The secret used to HMAC-sign requests delivered to the endpoint. At least 32 characters. Write-only: it is stored encrypted and never returned in responses.
28
+ attr_accessor :signing_secret
29
+
30
+ attr_accessor :kind
31
+
32
+ # The per-request timeout backstop for trigger requests, in seconds. Defaults to 60.
33
+ attr_accessor :request_timeout_seconds
34
+
35
+ # How often the healthcheck URL is polled, in seconds. Defaults to 30.
36
+ attr_accessor :poll_interval_seconds
37
+
38
+ # The inline wait budget for durable results, in milliseconds. Defaults to 5000.
39
+ attr_accessor :inline_wait_budget_ms
40
+
41
+ # Worker labels applied to the worker the operator creates for this endpoint.
42
+ attr_accessor :labels
43
+
44
+ # Whether the operator polls and dispatches to this endpoint. Defaults to true.
45
+ attr_accessor :enabled
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'name' => :'name',
73
+ :'healthcheck_url' => :'healthcheckUrl',
74
+ :'trigger_url' => :'triggerUrl',
75
+ :'signing_secret' => :'signingSecret',
76
+ :'kind' => :'kind',
77
+ :'request_timeout_seconds' => :'requestTimeoutSeconds',
78
+ :'poll_interval_seconds' => :'pollIntervalSeconds',
79
+ :'inline_wait_budget_ms' => :'inlineWaitBudgetMs',
80
+ :'labels' => :'labels',
81
+ :'enabled' => :'enabled'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'name' => :'String',
99
+ :'healthcheck_url' => :'String',
100
+ :'trigger_url' => :'String',
101
+ :'signing_secret' => :'String',
102
+ :'kind' => :'V1ServerlessEndpointKind',
103
+ :'request_timeout_seconds' => :'Integer',
104
+ :'poll_interval_seconds' => :'Integer',
105
+ :'inline_wait_budget_ms' => :'Integer',
106
+ :'labels' => :'Hash<String, Object>',
107
+ :'enabled' => :'Boolean'
108
+ }
109
+ end
110
+
111
+ # List of attributes with nullable: true
112
+ def self.openapi_nullable
113
+ Set.new([
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1CreateServerlessEndpointRequest` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ acceptable_attribute_map = self.class.acceptable_attribute_map
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!acceptable_attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1CreateServerlessEndpointRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'name')
134
+ self.name = attributes[:'name']
135
+ else
136
+ self.name = nil
137
+ end
138
+
139
+ if attributes.key?(:'healthcheck_url')
140
+ self.healthcheck_url = attributes[:'healthcheck_url']
141
+ else
142
+ self.healthcheck_url = nil
143
+ end
144
+
145
+ if attributes.key?(:'trigger_url')
146
+ self.trigger_url = attributes[:'trigger_url']
147
+ else
148
+ self.trigger_url = nil
149
+ end
150
+
151
+ if attributes.key?(:'signing_secret')
152
+ self.signing_secret = attributes[:'signing_secret']
153
+ else
154
+ self.signing_secret = nil
155
+ end
156
+
157
+ if attributes.key?(:'kind')
158
+ self.kind = attributes[:'kind']
159
+ end
160
+
161
+ if attributes.key?(:'request_timeout_seconds')
162
+ self.request_timeout_seconds = attributes[:'request_timeout_seconds']
163
+ end
164
+
165
+ if attributes.key?(:'poll_interval_seconds')
166
+ self.poll_interval_seconds = attributes[:'poll_interval_seconds']
167
+ end
168
+
169
+ if attributes.key?(:'inline_wait_budget_ms')
170
+ self.inline_wait_budget_ms = attributes[:'inline_wait_budget_ms']
171
+ end
172
+
173
+ if attributes.key?(:'labels')
174
+ if (value = attributes[:'labels']).is_a?(Hash)
175
+ self.labels = value
176
+ end
177
+ end
178
+
179
+ if attributes.key?(:'enabled')
180
+ self.enabled = attributes[:'enabled']
181
+ end
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
188
+ invalid_properties = Array.new
189
+ if @name.nil?
190
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
191
+ end
192
+
193
+ if @healthcheck_url.nil?
194
+ invalid_properties.push('invalid value for "healthcheck_url", healthcheck_url cannot be nil.')
195
+ end
196
+
197
+ if @trigger_url.nil?
198
+ invalid_properties.push('invalid value for "trigger_url", trigger_url cannot be nil.')
199
+ end
200
+
201
+ if @signing_secret.nil?
202
+ invalid_properties.push('invalid value for "signing_secret", signing_secret cannot be nil.')
203
+ end
204
+
205
+ if @signing_secret.to_s.length < 32
206
+ invalid_properties.push('invalid value for "signing_secret", the character length must be greater than or equal to 32.')
207
+ end
208
+
209
+ invalid_properties
210
+ end
211
+
212
+ # Check to see if the all the properties in the model are valid
213
+ # @return true if the model is valid
214
+ def valid?
215
+ warn '[DEPRECATED] the `valid?` method is obsolete'
216
+ return false if @name.nil?
217
+ return false if @healthcheck_url.nil?
218
+ return false if @trigger_url.nil?
219
+ return false if @signing_secret.nil?
220
+ return false if @signing_secret.to_s.length < 32
221
+ true
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] name Value to be assigned
226
+ def name=(name)
227
+ if name.nil?
228
+ fail ArgumentError, 'name cannot be nil'
229
+ end
230
+
231
+ @name = name
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] healthcheck_url Value to be assigned
236
+ def healthcheck_url=(healthcheck_url)
237
+ if healthcheck_url.nil?
238
+ fail ArgumentError, 'healthcheck_url cannot be nil'
239
+ end
240
+
241
+ @healthcheck_url = healthcheck_url
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] trigger_url Value to be assigned
246
+ def trigger_url=(trigger_url)
247
+ if trigger_url.nil?
248
+ fail ArgumentError, 'trigger_url cannot be nil'
249
+ end
250
+
251
+ @trigger_url = trigger_url
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] signing_secret Value to be assigned
256
+ def signing_secret=(signing_secret)
257
+ if signing_secret.nil?
258
+ fail ArgumentError, 'signing_secret cannot be nil'
259
+ end
260
+
261
+ if signing_secret.to_s.length < 32
262
+ fail ArgumentError, 'invalid value for "signing_secret", the character length must be greater than or equal to 32.'
263
+ end
264
+
265
+ @signing_secret = signing_secret
266
+ end
267
+
268
+ # Checks equality by comparing each attribute.
269
+ # @param [Object] Object to be compared
270
+ def ==(o)
271
+ return true if self.equal?(o)
272
+ self.class == o.class &&
273
+ name == o.name &&
274
+ healthcheck_url == o.healthcheck_url &&
275
+ trigger_url == o.trigger_url &&
276
+ signing_secret == o.signing_secret &&
277
+ kind == o.kind &&
278
+ request_timeout_seconds == o.request_timeout_seconds &&
279
+ poll_interval_seconds == o.poll_interval_seconds &&
280
+ inline_wait_budget_ms == o.inline_wait_budget_ms &&
281
+ labels == o.labels &&
282
+ enabled == o.enabled
283
+ end
284
+
285
+ # @see the `==` method
286
+ # @param [Object] Object to be compared
287
+ def eql?(o)
288
+ self == o
289
+ end
290
+
291
+ # Calculates hash code according to all attributes.
292
+ # @return [Integer] Hash code
293
+ def hash
294
+ [name, healthcheck_url, trigger_url, signing_secret, kind, request_timeout_seconds, poll_interval_seconds, inline_wait_budget_ms, labels, enabled].hash
295
+ end
296
+
297
+ # Builds the object from hash
298
+ # @param [Hash] attributes Model attributes in the form of hash
299
+ # @return [Object] Returns the model itself
300
+ def self.build_from_hash(attributes)
301
+ return nil unless attributes.is_a?(Hash)
302
+ attributes = attributes.transform_keys(&:to_sym)
303
+ transformed_hash = {}
304
+ openapi_types.each_pair do |key, type|
305
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
306
+ transformed_hash["#{key}"] = nil
307
+ elsif type =~ /\AArray<(.*)>/i
308
+ # check to ensure the input is an array given that the attribute
309
+ # is documented as an array but the input is not
310
+ if attributes[attribute_map[key]].is_a?(Array)
311
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
312
+ end
313
+ elsif !attributes[attribute_map[key]].nil?
314
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
315
+ end
316
+ end
317
+ new(transformed_hash)
318
+ end
319
+
320
+ # Deserializes the data based on type
321
+ # @param string type Data type
322
+ # @param string value Value to be deserialized
323
+ # @return [Object] Deserialized data
324
+ def self._deserialize(type, value)
325
+ case type.to_sym
326
+ when :Time
327
+ Time.parse(value)
328
+ when :Date
329
+ Date.parse(value)
330
+ when :String
331
+ value.to_s
332
+ when :Integer
333
+ value.to_i
334
+ when :Float
335
+ value.to_f
336
+ when :Boolean
337
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
338
+ true
339
+ else
340
+ false
341
+ end
342
+ when :Object
343
+ # generic object (usually a Hash), return directly
344
+ value
345
+ when /\AArray<(?<inner_type>.+)>\z/
346
+ inner_type = Regexp.last_match[:inner_type]
347
+ value.map { |v| _deserialize(inner_type, v) }
348
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
349
+ k_type = Regexp.last_match[:k_type]
350
+ v_type = Regexp.last_match[:v_type]
351
+ {}.tap do |hash|
352
+ value.each do |k, v|
353
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
354
+ end
355
+ end
356
+ else # model
357
+ # models (e.g. Pet) or oneOf
358
+ klass = HatchetSdkRest.const_get(type)
359
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
360
+ end
361
+ end
362
+
363
+ # Returns the string representation of the object
364
+ # @return [String] String presentation of the object
365
+ def to_s
366
+ to_hash.to_s
367
+ end
368
+
369
+ # to_body is an alias to to_hash (backward compatibility)
370
+ # @return [Hash] Returns the object in the form of hash
371
+ def to_body
372
+ to_hash
373
+ end
374
+
375
+ # Returns the object in the form of hash
376
+ # @return [Hash] Returns the object in the form of hash
377
+ def to_hash
378
+ hash = {}
379
+ self.class.attribute_map.each_pair do |attr, param|
380
+ value = self.send(attr)
381
+ if value.nil?
382
+ is_nullable = self.class.openapi_nullable.include?(attr)
383
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
384
+ end
385
+
386
+ hash[param] = _to_hash(value)
387
+ end
388
+ hash
389
+ end
390
+
391
+ # Outputs non-array value in the form of hash
392
+ # For object, use to_hash. Otherwise, just return the value
393
+ # @param [Object] value Any valid value
394
+ # @return [Hash] Returns the value in the form of hash
395
+ def _to_hash(value)
396
+ if value.is_a?(Array)
397
+ value.compact.map { |v| _to_hash(v) }
398
+ elsif value.is_a?(Hash)
399
+ {}.tap do |hash|
400
+ value.each { |k, v| hash[k] = _to_hash(v) }
401
+ end
402
+ elsif value.respond_to? :to_hash
403
+ value.to_hash
404
+ else
405
+ value
406
+ end
407
+ end
408
+
409
+ end
410
+
411
+ end