volcano-sdk 0.9.4 → 0.10.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +69 -0
  3. data/lib/volcano/client.rb +2 -1
  4. data/lib/volcano/durable.rb +136 -0
  5. data/lib/volcano/durable_models.rb +143 -0
  6. data/lib/volcano/generated/lib/volcano-generated/api/databases_api.rb +2 -2
  7. data/lib/volcano/generated/lib/volcano-generated/api/durable_functions_api.rb +1239 -0
  8. data/lib/volcano/generated/lib/volcano-generated/api/frontends_api.rb +2 -2
  9. data/lib/volcano/generated/lib/volcano-generated/api/functions_api.rb +18 -6
  10. data/lib/volcano/generated/lib/volcano-generated/api/o_auth_authentication_api.rb +2 -2
  11. data/lib/volcano/generated/lib/volcano-generated/api/projects_api.rb +76 -2
  12. data/lib/volcano/generated/lib/volcano-generated/models/create_database_request.rb +6 -8
  13. data/lib/volcano/generated/lib/volcano-generated/models/create_variable_request.rb +11 -1
  14. data/lib/volcano/generated/lib/volcano-generated/models/durable_execution.rb +358 -0
  15. data/lib/volcano/generated/lib/volcano-generated/models/durable_execution_error.rb +157 -0
  16. data/lib/volcano/generated/lib/volcano-generated/models/durable_execution_status.rb +45 -0
  17. data/lib/volcano/generated/lib/volcano-generated/models/durable_function.rb +479 -0
  18. data/lib/volcano/generated/lib/volcano-generated/models/durable_function_config.rb +193 -0
  19. data/lib/volcano/generated/lib/volcano-generated/models/function_kind.rb +40 -0
  20. data/lib/volcano/generated/lib/volcano-generated/models/function_runtime_option.rb +28 -1
  21. data/lib/volcano/generated/lib/volcano-generated/models/function_scheduler.rb +11 -1
  22. data/lib/volcano/generated/lib/volcano-generated/models/list_database_regions200_response_inner.rb +1 -1
  23. data/lib/volcano/generated/lib/volcano-generated/models/metric_usage_data.rb +1 -1
  24. data/lib/volcano/generated/lib/volcano-generated/models/paginated_durable_executions.rb +274 -0
  25. data/lib/volcano/generated/lib/volcano-generated/models/paginated_durable_functions.rb +274 -0
  26. data/lib/volcano/generated/lib/volcano-generated/models/project_config.rb +23 -1
  27. data/lib/volcano/generated/lib/volcano-generated/models/project_config_function.rb +47 -2
  28. data/lib/volcano/generated/lib/volcano-generated/models/project_config_variable.rb +11 -1
  29. data/lib/volcano/generated/lib/volcano-generated/models/project_deployment_resource.rb +14 -4
  30. data/lib/volcano/generated/lib/volcano-generated/models/project_health_resource.rb +14 -4
  31. data/lib/volcano/generated/lib/volcano-generated/models/replace_shared_variables_request.rb +237 -0
  32. data/lib/volcano/generated/lib/volcano-generated/models/update_variable_request.rb +11 -1
  33. data/lib/volcano/generated/lib/volcano-generated/models/variable.rb +11 -1
  34. data/lib/volcano/generated/lib/volcano-generated.rb +10 -0
  35. data/lib/volcano/generated_transport.rb +2 -1
  36. data/lib/volcano/generated_transport_durable.rb +50 -0
  37. data/lib/volcano/generated_transport_support.rb +1 -0
  38. data/lib/volcano/version.rb +1 -1
  39. data/lib/volcano.rb +2 -0
  40. metadata +14 -1
@@ -0,0 +1,358 @@
1
+ =begin
2
+ #Volcano Hosting API
3
+
4
+ #Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: support@volcano.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Volcano::Generated
17
+ class DurableExecution < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :function_id
21
+
22
+ # Idempotency key for the execution. Supplied by the client through `X-Volcano-Execution-Name`, otherwise generated.
23
+ attr_accessor :name
24
+
25
+ attr_accessor :status
26
+
27
+ # Region the execution runs in. An execution is pinned to one region for its whole life because its checkpoints live there.
28
+ attr_accessor :region
29
+
30
+ # Whatever the function returned, verbatim. Absent while the execution is still running, absent when the result was too large to return and was checkpointed instead, and absent once the retention period has lapsed.
31
+ attr_accessor :result
32
+
33
+ # `true` when the execution is terminal but its result is no longer retained, which distinguishes a discarded result from an empty one. Shortly after that the execution itself is dropped and reads answer `404`. A result that was checkpointed rather than returned leaves this unset, so it reads like a function that returned nothing.
34
+ attr_accessor :result_expired
35
+
36
+ attr_accessor :error
37
+
38
+ attr_accessor :created_at
39
+
40
+ # Present once the execution has reached a terminal status.
41
+ attr_accessor :completed_at
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'id' => :'id',
69
+ :'function_id' => :'function_id',
70
+ :'name' => :'name',
71
+ :'status' => :'status',
72
+ :'region' => :'region',
73
+ :'result' => :'result',
74
+ :'result_expired' => :'result_expired',
75
+ :'error' => :'error',
76
+ :'created_at' => :'created_at',
77
+ :'completed_at' => :'completed_at'
78
+ }
79
+ end
80
+
81
+ # Returns attribute mapping this model knows about
82
+ def self.acceptable_attribute_map
83
+ attribute_map
84
+ end
85
+
86
+ # Returns all the JSON keys this model knows about
87
+ def self.acceptable_attributes
88
+ acceptable_attribute_map.values
89
+ end
90
+
91
+ # Attribute type mapping.
92
+ def self.openapi_types
93
+ {
94
+ :'id' => :'String',
95
+ :'function_id' => :'String',
96
+ :'name' => :'String',
97
+ :'status' => :'DurableExecutionStatus',
98
+ :'region' => :'String',
99
+ :'result' => :'Object',
100
+ :'result_expired' => :'Boolean',
101
+ :'error' => :'DurableExecutionError',
102
+ :'created_at' => :'Time',
103
+ :'completed_at' => :'Time'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ :'result',
111
+ ])
112
+ end
113
+
114
+ # Initializes the object
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ def initialize(attributes = {})
117
+ if (!attributes.is_a?(Hash))
118
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::DurableExecution` initialize method"
119
+ end
120
+
121
+ # check to see if the attribute exists and convert string to symbol for hash key
122
+ acceptable_attribute_map = self.class.acceptable_attribute_map
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!acceptable_attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::DurableExecution`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'id')
131
+ self.id = attributes[:'id']
132
+ else
133
+ self.id = nil
134
+ end
135
+
136
+ if attributes.key?(:'function_id')
137
+ self.function_id = attributes[:'function_id']
138
+ else
139
+ self.function_id = nil
140
+ end
141
+
142
+ if attributes.key?(:'name')
143
+ self.name = attributes[:'name']
144
+ else
145
+ self.name = nil
146
+ end
147
+
148
+ if attributes.key?(:'status')
149
+ self.status = attributes[:'status']
150
+ else
151
+ self.status = nil
152
+ end
153
+
154
+ if attributes.key?(:'region')
155
+ self.region = attributes[:'region']
156
+ else
157
+ self.region = nil
158
+ end
159
+
160
+ if attributes.key?(:'result')
161
+ self.result = attributes[:'result']
162
+ end
163
+
164
+ if attributes.key?(:'result_expired')
165
+ self.result_expired = attributes[:'result_expired']
166
+ end
167
+
168
+ if attributes.key?(:'error')
169
+ self.error = attributes[:'error']
170
+ end
171
+
172
+ if attributes.key?(:'created_at')
173
+ self.created_at = attributes[:'created_at']
174
+ else
175
+ self.created_at = nil
176
+ end
177
+
178
+ if attributes.key?(:'completed_at')
179
+ self.completed_at = attributes[:'completed_at']
180
+ end
181
+ end
182
+
183
+ # Show invalid properties with the reasons. Usually used together with valid?
184
+ # @return Array for valid properties with the reasons
185
+ def list_invalid_properties
186
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
187
+ invalid_properties = Array.new
188
+ if @id.nil?
189
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
190
+ end
191
+
192
+ if @function_id.nil?
193
+ invalid_properties.push('invalid value for "function_id", function_id cannot be nil.')
194
+ end
195
+
196
+ if @name.nil?
197
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
198
+ end
199
+
200
+ if @status.nil?
201
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
202
+ end
203
+
204
+ if @region.nil?
205
+ invalid_properties.push('invalid value for "region", region cannot be nil.')
206
+ end
207
+
208
+ if @created_at.nil?
209
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
210
+ end
211
+
212
+ invalid_properties
213
+ end
214
+
215
+ # Check to see if the all the properties in the model are valid
216
+ # @return true if the model is valid
217
+ def valid?
218
+ warn '[DEPRECATED] the `valid?` method is obsolete'
219
+ return false if @id.nil?
220
+ return false if @function_id.nil?
221
+ return false if @name.nil?
222
+ return false if @status.nil?
223
+ return false if @region.nil?
224
+ return false if @created_at.nil?
225
+ true
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] id Value to be assigned
230
+ def id=(id)
231
+ if id.nil?
232
+ fail ArgumentError, 'id cannot be nil'
233
+ end
234
+
235
+ @id = id
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] function_id Value to be assigned
240
+ def function_id=(function_id)
241
+ if function_id.nil?
242
+ fail ArgumentError, 'function_id cannot be nil'
243
+ end
244
+
245
+ @function_id = function_id
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] name Value to be assigned
250
+ def name=(name)
251
+ if name.nil?
252
+ fail ArgumentError, 'name cannot be nil'
253
+ end
254
+
255
+ @name = name
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] status Value to be assigned
260
+ def status=(status)
261
+ if status.nil?
262
+ fail ArgumentError, 'status cannot be nil'
263
+ end
264
+
265
+ @status = status
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] region Value to be assigned
270
+ def region=(region)
271
+ if region.nil?
272
+ fail ArgumentError, 'region cannot be nil'
273
+ end
274
+
275
+ @region = region
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] created_at Value to be assigned
280
+ def created_at=(created_at)
281
+ if created_at.nil?
282
+ fail ArgumentError, 'created_at cannot be nil'
283
+ end
284
+
285
+ @created_at = created_at
286
+ end
287
+
288
+ # Checks equality by comparing each attribute.
289
+ # @param [Object] Object to be compared
290
+ def ==(o)
291
+ return true if self.equal?(o)
292
+ self.class == o.class &&
293
+ id == o.id &&
294
+ function_id == o.function_id &&
295
+ name == o.name &&
296
+ status == o.status &&
297
+ region == o.region &&
298
+ result == o.result &&
299
+ result_expired == o.result_expired &&
300
+ error == o.error &&
301
+ created_at == o.created_at &&
302
+ completed_at == o.completed_at
303
+ end
304
+
305
+ # @see the `==` method
306
+ # @param [Object] Object to be compared
307
+ def eql?(o)
308
+ self == o
309
+ end
310
+
311
+ # Calculates hash code according to all attributes.
312
+ # @return [Integer] Hash code
313
+ def hash
314
+ [id, function_id, name, status, region, result, result_expired, error, created_at, completed_at].hash
315
+ end
316
+
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def self.build_from_hash(attributes)
321
+ return nil unless attributes.is_a?(Hash)
322
+ attributes = attributes.transform_keys(&:to_sym)
323
+ transformed_hash = {}
324
+ openapi_types.each_pair do |key, type|
325
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
326
+ transformed_hash["#{key}"] = nil
327
+ elsif type =~ /\AArray<(.*)>/i
328
+ # check to ensure the input is an array given that the attribute
329
+ # is documented as an array but the input is not
330
+ if attributes[attribute_map[key]].is_a?(Array)
331
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
332
+ end
333
+ elsif !attributes[attribute_map[key]].nil?
334
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
335
+ end
336
+ end
337
+ new(transformed_hash)
338
+ end
339
+
340
+ # Returns the object in the form of hash
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_hash
343
+ hash = {}
344
+ self.class.attribute_map.each_pair do |attr, param|
345
+ value = self.send(attr)
346
+ if value.nil?
347
+ is_nullable = self.class.openapi_nullable.include?(attr)
348
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
349
+ end
350
+
351
+ hash[param] = _to_hash(value)
352
+ end
353
+ hash
354
+ end
355
+
356
+ end
357
+
358
+ end
@@ -0,0 +1,157 @@
1
+ =begin
2
+ #Volcano Hosting API
3
+
4
+ #Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: support@volcano.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Volcano::Generated
17
+ # Why a failed or timed-out execution ended.
18
+ class DurableExecutionError < ApiModelBase
19
+ attr_accessor :type
20
+
21
+ attr_accessor :message
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'type' => :'type',
27
+ :'message' => :'message'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'type' => :'String',
45
+ :'message' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::DurableExecutionError` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::DurableExecutionError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'type')
72
+ self.type = attributes[:'type']
73
+ end
74
+
75
+ if attributes.key?(:'message')
76
+ self.message = attributes[:'message']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ warn '[DEPRECATED] the `valid?` method is obsolete'
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ type == o.type &&
101
+ message == o.message
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [type, message].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ transformed_hash = {}
123
+ openapi_types.each_pair do |key, type|
124
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = nil
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[attribute_map[key]].is_a?(Array)
130
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
131
+ end
132
+ elsif !attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
134
+ end
135
+ end
136
+ new(transformed_hash)
137
+ end
138
+
139
+ # Returns the object in the form of hash
140
+ # @return [Hash] Returns the object in the form of hash
141
+ def to_hash
142
+ hash = {}
143
+ self.class.attribute_map.each_pair do |attr, param|
144
+ value = self.send(attr)
145
+ if value.nil?
146
+ is_nullable = self.class.openapi_nullable.include?(attr)
147
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
148
+ end
149
+
150
+ hash[param] = _to_hash(value)
151
+ end
152
+ hash
153
+ end
154
+
155
+ end
156
+
157
+ end
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #Volcano Hosting API
3
+
4
+ #Public API for Volcano Hosting clients, SDKs, and CLI tooling (Port 8000). This specification intentionally excludes first-party/internal APIs. See api/openapi-internal.yaml for non-public internal and Builder operations.
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: support@volcano.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Volcano::Generated
17
+ class DurableExecutionStatus
18
+ PENDING = "pending".freeze
19
+ RUNNING = "running".freeze
20
+ SUCCEEDED = "succeeded".freeze
21
+ FAILED = "failed".freeze
22
+ TIMED_OUT = "timed_out".freeze
23
+ STOPPED = "stopped".freeze
24
+ UNKNOWN = "unknown".freeze
25
+
26
+ def self.all_vars
27
+ @all_vars ||= [PENDING, RUNNING, SUCCEEDED, FAILED, TIMED_OUT, STOPPED, UNKNOWN].freeze
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def self.build_from_hash(value)
34
+ new.build_from_hash(value)
35
+ end
36
+
37
+ # Builds the enum from string
38
+ # @param [String] The enum value in the form of the string
39
+ # @return [String] The enum value
40
+ def build_from_hash(value)
41
+ return value if DurableExecutionStatus.all_vars.include?(value)
42
+ raise "Invalid ENUM value #{value} for class #DurableExecutionStatus"
43
+ end
44
+ end
45
+ end