volcano-sdk 0.34.0 → 0.35.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 (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -4
  3. data/lib/volcano/client.rb +1 -1
  4. data/lib/volcano/durable.rb +9 -4
  5. data/lib/volcano/durable_approval_models.rb +1 -1
  6. data/lib/volcano/durable_message_arguments.rb +49 -0
  7. data/lib/volcano/durable_message_backlog.rb +38 -0
  8. data/lib/volcano/durable_message_catch_ups.rb +112 -0
  9. data/lib/volcano/durable_message_models.rb +62 -0
  10. data/lib/volcano/durable_message_responses.rb +107 -0
  11. data/lib/volcano/durable_message_session.rb +72 -0
  12. data/lib/volcano/durable_message_stream.rb +176 -0
  13. data/lib/volcano/durable_messages.rb +217 -0
  14. data/lib/volcano/durable_models.rb +32 -3
  15. data/lib/volcano/generated/lib/volcano-generated/api/auth_admin_api.rb +2 -2
  16. data/lib/volcano/generated/lib/volcano-generated/api/auth_configuration_api.rb +2 -2
  17. data/lib/volcano/generated/lib/volcano-generated/api/autofix_api.rb +222 -0
  18. data/lib/volcano/generated/lib/volcano-generated/api/durable_functions_api.rb +725 -0
  19. data/lib/volcano/generated/lib/volcano-generated/api/frontends_api.rb +2 -2
  20. data/lib/volcano/generated/lib/volcano-generated/api/issues_api.rb +254 -0
  21. data/lib/volcano/generated/lib/volcano-generated/api/sandboxes_api.rb +20 -20
  22. data/lib/volcano/generated/lib/volcano-generated/api/system_api.rb +57 -0
  23. data/lib/volcano/generated/lib/volcano-generated/api/variable_environments_api.rb +373 -0
  24. data/lib/volcano/generated/lib/volcano-generated/api/verified_domains_api.rb +2 -2
  25. data/lib/volcano/generated/lib/volcano-generated/models/auth_config.rb +46 -4
  26. data/lib/volcano/generated/lib/volcano-generated/models/auth_insights_series_point.rb +110 -2
  27. data/lib/volcano/generated/lib/volcano-generated/models/autofix_model.rb +45 -0
  28. data/lib/volcano/generated/lib/volcano-generated/models/autofix_provider.rb +40 -0
  29. data/lib/volcano/generated/lib/volcano-generated/models/autofix_settings.rb +385 -0
  30. data/lib/volcano/generated/lib/volcano-generated/models/autofix_stage.rb +40 -0
  31. data/lib/volcano/generated/lib/volcano-generated/models/capability.rb +214 -0
  32. data/lib/volcano/generated/lib/volcano-generated/models/capability_list.rb +166 -0
  33. data/lib/volcano/generated/lib/volcano-generated/models/capability_status.rb +40 -0
  34. data/lib/volcano/generated/lib/volcano-generated/models/create_sandbox_session_request.rb +16 -53
  35. data/lib/volcano/generated/lib/volcano-generated/models/create_variable_environment_request.rb +176 -0
  36. data/lib/volcano/generated/lib/volcano-generated/models/durable_execution.rb +14 -4
  37. data/lib/volcano/generated/lib/volcano-generated/models/durable_message.rb +396 -0
  38. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_direction.rb +40 -0
  39. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_list.rb +194 -0
  40. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_sender.rb +203 -0
  41. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_session_registration.rb +165 -0
  42. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_status.rb +43 -0
  43. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_wait.rb +278 -0
  44. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_wait_list.rb +167 -0
  45. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_wait_registration.rb +225 -0
  46. data/lib/volcano/generated/lib/volcano-generated/models/durable_message_wait_status.rb +43 -0
  47. data/lib/volcano/generated/lib/volcano-generated/models/frontend.rb +11 -1
  48. data/lib/volcano/generated/lib/volcano-generated/models/frontend_custom_domain_conflict_error.rb +1 -1
  49. data/lib/volcano/generated/lib/volcano-generated/models/frontend_custom_domain_response.rb +25 -2
  50. data/lib/volcano/generated/lib/volcano-generated/models/issue.rb +493 -0
  51. data/lib/volcano/generated/lib/volcano-generated/models/issue_status.rb +41 -0
  52. data/lib/volcano/generated/lib/volcano-generated/models/metric_usage_data.rb +1 -1
  53. data/lib/volcano/generated/lib/volcano-generated/models/open_durable_message_session_request.rb +228 -0
  54. data/lib/volcano/generated/lib/volcano-generated/models/paginated_issues.rb +230 -0
  55. data/lib/volcano/generated/lib/volcano-generated/models/project_config.rb +10 -1
  56. data/lib/volcano/generated/lib/volcano-generated/models/project_config_autofix.rb +206 -0
  57. data/lib/volcano/generated/lib/volcano-generated/models/project_config_custom_domain.rb +1 -1
  58. data/lib/volcano/generated/lib/volcano-generated/models/project_config_sandbox.rb +12 -50
  59. data/lib/volcano/generated/lib/volcano-generated/models/project_frontend_custom_domain.rb +25 -2
  60. data/lib/volcano/generated/lib/volcano-generated/models/publish_durable_message_request.rb +205 -0
  61. data/lib/volcano/generated/lib/volcano-generated/models/register_durable_message_wait_request.rb +284 -0
  62. data/lib/volcano/generated/lib/volcano-generated/models/rename_variable_environment_request.rb +176 -0
  63. data/lib/volcano/generated/lib/volcano-generated/models/request_durable_approval_request.rb +1 -1
  64. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_command_request.rb +11 -12
  65. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_execution_request.rb +51 -13
  66. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_session.rb +4 -30
  67. data/lib/volcano/generated/lib/volcano-generated/models/send_durable_message_request.rb +205 -0
  68. data/lib/volcano/generated/lib/volcano-generated/models/update_auth_config_request.rb +79 -1
  69. data/lib/volcano/generated/lib/volcano-generated/models/update_autofix_settings_request.rb +273 -0
  70. data/lib/volcano/generated/lib/volcano-generated/models/update_issue_request.rb +186 -0
  71. data/lib/volcano/generated/lib/volcano-generated/models/variable_environment.rb +325 -0
  72. data/lib/volcano/generated/lib/volcano-generated/models/variable_environment_list.rb +175 -0
  73. data/lib/volcano/generated/lib/volcano-generated.rb +34 -0
  74. data/lib/volcano/generated_transport.rb +1 -0
  75. data/lib/volcano/generated_transport_durable_messages.rb +57 -0
  76. data/lib/volcano/realtime/channel_callbacks.rb +5 -1
  77. data/lib/volcano/realtime/channel_lifecycle.rb +4 -1
  78. data/lib/volcano/realtime/durable_channel.rb +47 -0
  79. data/lib/volcano/realtime/lifecycle.rb +37 -1
  80. data/lib/volcano/realtime/protocol.rb +7 -3
  81. data/lib/volcano/realtime/protocol_dispatch.rb +1 -1
  82. data/lib/volcano/realtime/protocol_io.rb +7 -4
  83. data/lib/volcano/realtime/protocol_lifecycle.rb +7 -0
  84. data/lib/volcano/realtime/protocol_recovery.rb +23 -12
  85. data/lib/volcano/realtime.rb +42 -8
  86. data/lib/volcano/redaction.rb +1 -1
  87. data/lib/volcano/version.rb +1 -1
  88. data/lib/volcano.rb +8 -0
  89. data/sig/core_facades.rbs +15 -0
  90. data/sig/durable_message_records.rbs +68 -0
  91. data/sig/durable_records.rbs +17 -9
  92. metadata +46 -1
@@ -0,0 +1,278 @@
1
+ =begin
2
+ #Volcano API
3
+
4
+ #Public API for Volcano 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
+ # A wait an execution has open for a message.
18
+ class DurableMessageWait < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :status
24
+
25
+ # When the wait times out. Null when the workflow set no timeout.
26
+ attr_accessor :expires_at
27
+
28
+ attr_accessor :created_at
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'id' => :'id',
56
+ :'name' => :'name',
57
+ :'status' => :'status',
58
+ :'expires_at' => :'expires_at',
59
+ :'created_at' => :'created_at'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'id' => :'String',
77
+ :'name' => :'String',
78
+ :'status' => :'DurableMessageWaitStatus',
79
+ :'expires_at' => :'Time',
80
+ :'created_at' => :'Time'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ :'expires_at',
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::DurableMessageWait` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ acceptable_attribute_map = self.class.acceptable_attribute_map
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!acceptable_attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::DurableMessageWait`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'id')
108
+ self.id = attributes[:'id']
109
+ else
110
+ self.id = nil
111
+ end
112
+
113
+ if attributes.key?(:'name')
114
+ self.name = attributes[:'name']
115
+ else
116
+ self.name = nil
117
+ end
118
+
119
+ if attributes.key?(:'status')
120
+ self.status = attributes[:'status']
121
+ else
122
+ self.status = nil
123
+ end
124
+
125
+ if attributes.key?(:'expires_at')
126
+ self.expires_at = attributes[:'expires_at']
127
+ else
128
+ self.expires_at = nil
129
+ end
130
+
131
+ if attributes.key?(:'created_at')
132
+ self.created_at = attributes[:'created_at']
133
+ else
134
+ self.created_at = nil
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
+ invalid_properties = Array.new
143
+ if @id.nil?
144
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
145
+ end
146
+
147
+ if @name.nil?
148
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
149
+ end
150
+
151
+ if @status.nil?
152
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
153
+ end
154
+
155
+ if @created_at.nil?
156
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
157
+ end
158
+
159
+ invalid_properties
160
+ end
161
+
162
+ # Check to see if the all the properties in the model are valid
163
+ # @return true if the model is valid
164
+ def valid?
165
+ warn '[DEPRECATED] the `valid?` method is obsolete'
166
+ return false if @id.nil?
167
+ return false if @name.nil?
168
+ return false if @status.nil?
169
+ return false if @created_at.nil?
170
+ true
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] id Value to be assigned
175
+ def id=(id)
176
+ if id.nil?
177
+ fail ArgumentError, 'id cannot be nil'
178
+ end
179
+
180
+ @id = id
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] name Value to be assigned
185
+ def name=(name)
186
+ if name.nil?
187
+ fail ArgumentError, 'name cannot be nil'
188
+ end
189
+
190
+ @name = name
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] status Value to be assigned
195
+ def status=(status)
196
+ if status.nil?
197
+ fail ArgumentError, 'status cannot be nil'
198
+ end
199
+
200
+ @status = status
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] created_at Value to be assigned
205
+ def created_at=(created_at)
206
+ if created_at.nil?
207
+ fail ArgumentError, 'created_at cannot be nil'
208
+ end
209
+
210
+ @created_at = created_at
211
+ end
212
+
213
+ # Checks equality by comparing each attribute.
214
+ # @param [Object] Object to be compared
215
+ def ==(o)
216
+ return true if self.equal?(o)
217
+ self.class == o.class &&
218
+ id == o.id &&
219
+ name == o.name &&
220
+ status == o.status &&
221
+ expires_at == o.expires_at &&
222
+ created_at == o.created_at
223
+ end
224
+
225
+ # @see the `==` method
226
+ # @param [Object] Object to be compared
227
+ def eql?(o)
228
+ self == o
229
+ end
230
+
231
+ # Calculates hash code according to all attributes.
232
+ # @return [Integer] Hash code
233
+ def hash
234
+ [id, name, status, expires_at, created_at].hash
235
+ end
236
+
237
+ # Builds the object from hash
238
+ # @param [Hash] attributes Model attributes in the form of hash
239
+ # @return [Object] Returns the model itself
240
+ def self.build_from_hash(attributes)
241
+ return nil unless attributes.is_a?(Hash)
242
+ attributes = attributes.transform_keys(&:to_sym)
243
+ transformed_hash = {}
244
+ openapi_types.each_pair do |key, type|
245
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = nil
247
+ elsif type =~ /\AArray<(.*)>/i
248
+ # check to ensure the input is an array given that the attribute
249
+ # is documented as an array but the input is not
250
+ if attributes[attribute_map[key]].is_a?(Array)
251
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
252
+ end
253
+ elsif !attributes[attribute_map[key]].nil?
254
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
255
+ end
256
+ end
257
+ new(transformed_hash)
258
+ end
259
+
260
+ # Returns the object in the form of hash
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_hash
263
+ hash = {}
264
+ self.class.attribute_map.each_pair do |attr, param|
265
+ value = self.send(attr)
266
+ if value.nil?
267
+ is_nullable = self.class.openapi_nullable.include?(attr)
268
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
269
+ end
270
+
271
+ hash[param] = _to_hash(value)
272
+ end
273
+ hash
274
+ end
275
+
276
+ end
277
+
278
+ end
@@ -0,0 +1,167 @@
1
+ =begin
2
+ #Volcano API
3
+
4
+ #Public API for Volcano 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 DurableMessageWaitList < ApiModelBase
18
+ # Open waits, oldest first.
19
+ attr_accessor :data
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'data' => :'data'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'data' => :'Array<DurableMessageWait>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::DurableMessageWaitList` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::DurableMessageWaitList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'data')
68
+ if (value = attributes[:'data']).is_a?(Array)
69
+ self.data = value
70
+ end
71
+ else
72
+ self.data = nil
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
+ invalid_properties = Array.new
81
+ if @data.nil?
82
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
83
+ end
84
+
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
+ return false if @data.nil?
93
+ true
94
+ end
95
+
96
+ # Custom attribute writer method with validation
97
+ # @param [Object] data Value to be assigned
98
+ def data=(data)
99
+ if data.nil?
100
+ fail ArgumentError, 'data cannot be nil'
101
+ end
102
+
103
+ @data = data
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ data == o.data
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [data].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
136
+ elsif type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
+ end
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
+ end
145
+ end
146
+ new(transformed_hash)
147
+ end
148
+
149
+ # Returns the object in the form of hash
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_hash
152
+ hash = {}
153
+ self.class.attribute_map.each_pair do |attr, param|
154
+ value = self.send(attr)
155
+ if value.nil?
156
+ is_nullable = self.class.openapi_nullable.include?(attr)
157
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
158
+ end
159
+
160
+ hash[param] = _to_hash(value)
161
+ end
162
+ hash
163
+ end
164
+
165
+ end
166
+
167
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #Volcano API
3
+
4
+ #Public API for Volcano 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
+ # The registered wait, as the waiting workflow sees it.
18
+ class DurableMessageWaitRegistration < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :status
22
+
23
+ attr_accessor :expires_at
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'id' => :'id',
51
+ :'status' => :'status',
52
+ :'expires_at' => :'expires_at'
53
+ }
54
+ end
55
+
56
+ # Returns attribute mapping this model knows about
57
+ def self.acceptable_attribute_map
58
+ attribute_map
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ acceptable_attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'id' => :'String',
70
+ :'status' => :'DurableMessageWaitStatus',
71
+ :'expires_at' => :'Time'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ :'expires_at'
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::DurableMessageWaitRegistration` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::DurableMessageWaitRegistration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'id')
99
+ self.id = attributes[:'id']
100
+ else
101
+ self.id = nil
102
+ end
103
+
104
+ if attributes.key?(:'status')
105
+ self.status = attributes[:'status']
106
+ else
107
+ self.status = nil
108
+ end
109
+
110
+ if attributes.key?(:'expires_at')
111
+ self.expires_at = attributes[:'expires_at']
112
+ else
113
+ self.expires_at = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @id.nil?
123
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
124
+ end
125
+
126
+ if @status.nil?
127
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @id.nil?
138
+ return false if @status.nil?
139
+ true
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] id Value to be assigned
144
+ def id=(id)
145
+ if id.nil?
146
+ fail ArgumentError, 'id cannot be nil'
147
+ end
148
+
149
+ @id = id
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] status Value to be assigned
154
+ def status=(status)
155
+ if status.nil?
156
+ fail ArgumentError, 'status cannot be nil'
157
+ end
158
+
159
+ @status = status
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ id == o.id &&
168
+ status == o.status &&
169
+ expires_at == o.expires_at
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [id, status, expires_at].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -0,0 +1,43 @@
1
+ =begin
2
+ #Volcano API
3
+
4
+ #Public API for Volcano 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 DurableMessageWaitStatus
18
+ WAITING = "waiting".freeze
19
+ MATCHED = "matched".freeze
20
+ DELIVERED = "delivered".freeze
21
+ EXPIRED = "expired".freeze
22
+ CANCELLED = "cancelled".freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [WAITING, MATCHED, DELIVERED, EXPIRED, CANCELLED].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if DurableMessageWaitStatus.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #DurableMessageWaitStatus"
41
+ end
42
+ end
43
+ end