volcano-sdk 0.32.7 → 0.33.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/lib/volcano/client.rb +3 -2
  4. data/lib/volcano/generated/lib/volcano-generated/api/sandboxes_api.rb +1433 -0
  5. data/lib/volcano/generated/lib/volcano-generated/models/create_sandbox_session_request.rb +294 -0
  6. data/lib/volcano/generated/lib/volcano-generated/models/create_sandbox_template_request.rb +247 -0
  7. data/lib/volcano/generated/lib/volcano-generated/models/publish_sandbox_preset_request.rb +268 -0
  8. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_access.rb +216 -0
  9. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_access_request.rb +221 -0
  10. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_capacity.rb +199 -0
  11. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_capacity_list.rb +166 -0
  12. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_command_request.rb +251 -0
  13. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_command_result.rb +294 -0
  14. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_deployment.rb +242 -0
  15. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_deployment_page.rb +192 -0
  16. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_execution_request.rb +329 -0
  17. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_execution_result.rb +381 -0
  18. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_file_read_request.rb +182 -0
  19. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_file_result.rb +164 -0
  20. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_file_write_request.rb +217 -0
  21. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_pagination.rb +199 -0
  22. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_preset.rb +294 -0
  23. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_preset_list.rb +166 -0
  24. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_session.rb +407 -0
  25. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_session_page.rb +192 -0
  26. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_subject_grant_request.rb +164 -0
  27. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_template.rb +321 -0
  28. data/lib/volcano/generated/lib/volcano-generated/models/sandbox_template_page.rb +192 -0
  29. data/lib/volcano/generated/lib/volcano-generated/models/update_sandbox_template_request.rb +175 -0
  30. data/lib/volcano/generated/lib/volcano-generated.rb +26 -0
  31. data/lib/volcano/generated_transport.rb +1 -0
  32. data/lib/volcano/generated_transport_sandbox.rb +69 -0
  33. data/lib/volcano/sandbox_files.rb +37 -0
  34. data/lib/volcano/sandbox_models.rb +24 -0
  35. data/lib/volcano/sandbox_request.rb +92 -0
  36. data/lib/volcano/sandbox_response.rb +74 -0
  37. data/lib/volcano/sandbox_session.rb +78 -0
  38. data/lib/volcano/sandboxes.rb +67 -0
  39. data/lib/volcano/version.rb +1 -1
  40. data/lib/volcano.rb +7 -0
  41. data/sig/client.rbs +1 -0
  42. data/sig/sandboxes.rbs +83 -0
  43. metadata +50 -2
@@ -0,0 +1,268 @@
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 PublishSandboxPresetRequest < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :preset
21
+
22
+ attr_accessor :memory_mb
23
+
24
+ attr_accessor :deployment_id
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'id' => :'id',
52
+ :'preset' => :'preset',
53
+ :'memory_mb' => :'memory_mb',
54
+ :'deployment_id' => :'deployment_id'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'id' => :'String',
72
+ :'preset' => :'String',
73
+ :'memory_mb' => :'Integer',
74
+ :'deployment_id' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::PublishSandboxPresetRequest` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::PublishSandboxPresetRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'id')
101
+ self.id = attributes[:'id']
102
+ else
103
+ self.id = nil
104
+ end
105
+
106
+ if attributes.key?(:'preset')
107
+ self.preset = attributes[:'preset']
108
+ else
109
+ self.preset = nil
110
+ end
111
+
112
+ if attributes.key?(:'memory_mb')
113
+ self.memory_mb = attributes[:'memory_mb']
114
+ else
115
+ self.memory_mb = nil
116
+ end
117
+
118
+ if attributes.key?(:'deployment_id')
119
+ self.deployment_id = attributes[:'deployment_id']
120
+ else
121
+ self.deployment_id = nil
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
129
+ invalid_properties = Array.new
130
+ if @id.nil?
131
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
132
+ end
133
+
134
+ if @preset.nil?
135
+ invalid_properties.push('invalid value for "preset", preset cannot be nil.')
136
+ end
137
+
138
+ if @memory_mb.nil?
139
+ invalid_properties.push('invalid value for "memory_mb", memory_mb cannot be nil.')
140
+ end
141
+
142
+ if @deployment_id.nil?
143
+ invalid_properties.push('invalid value for "deployment_id", deployment_id cannot be nil.')
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ warn '[DEPRECATED] the `valid?` method is obsolete'
153
+ return false if @id.nil?
154
+ return false if @preset.nil?
155
+ preset_validator = EnumAttributeValidator.new('String', ["python3.12", "node22"])
156
+ return false unless preset_validator.valid?(@preset)
157
+ return false if @memory_mb.nil?
158
+ memory_mb_validator = EnumAttributeValidator.new('Integer', [1024, 2048])
159
+ return false unless memory_mb_validator.valid?(@memory_mb)
160
+ return false if @deployment_id.nil?
161
+ true
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] id Value to be assigned
166
+ def id=(id)
167
+ if id.nil?
168
+ fail ArgumentError, 'id cannot be nil'
169
+ end
170
+
171
+ @id = id
172
+ end
173
+
174
+ # Custom attribute writer method checking allowed values (enum).
175
+ # @param [Object] preset Object to be assigned
176
+ def preset=(preset)
177
+ validator = EnumAttributeValidator.new('String', ["python3.12", "node22"])
178
+ unless validator.valid?(preset)
179
+ fail ArgumentError, "invalid value for \"preset\", must be one of #{validator.allowable_values}."
180
+ end
181
+ @preset = preset
182
+ end
183
+
184
+ # Custom attribute writer method checking allowed values (enum).
185
+ # @param [Object] memory_mb Object to be assigned
186
+ def memory_mb=(memory_mb)
187
+ validator = EnumAttributeValidator.new('Integer', [1024, 2048])
188
+ unless validator.valid?(memory_mb)
189
+ fail ArgumentError, "invalid value for \"memory_mb\", must be one of #{validator.allowable_values}."
190
+ end
191
+ @memory_mb = memory_mb
192
+ end
193
+
194
+ # Custom attribute writer method with validation
195
+ # @param [Object] deployment_id Value to be assigned
196
+ def deployment_id=(deployment_id)
197
+ if deployment_id.nil?
198
+ fail ArgumentError, 'deployment_id cannot be nil'
199
+ end
200
+
201
+ @deployment_id = deployment_id
202
+ end
203
+
204
+ # Checks equality by comparing each attribute.
205
+ # @param [Object] Object to be compared
206
+ def ==(o)
207
+ return true if self.equal?(o)
208
+ self.class == o.class &&
209
+ id == o.id &&
210
+ preset == o.preset &&
211
+ memory_mb == o.memory_mb &&
212
+ deployment_id == o.deployment_id
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [id, preset, memory_mb, deployment_id].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ attributes = attributes.transform_keys(&:to_sym)
233
+ transformed_hash = {}
234
+ openapi_types.each_pair do |key, type|
235
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = nil
237
+ elsif type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[attribute_map[key]].is_a?(Array)
241
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
242
+ end
243
+ elsif !attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
245
+ end
246
+ end
247
+ new(transformed_hash)
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ end
267
+
268
+ end
@@ -0,0 +1,216 @@
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 SandboxAccess < ApiModelBase
18
+ attr_accessor :url
19
+
20
+ attr_accessor :token
21
+
22
+ attr_accessor :expires_at
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'url' => :'url',
28
+ :'token' => :'token',
29
+ :'expires_at' => :'expires_at'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'url' => :'String',
47
+ :'token' => :'String',
48
+ :'expires_at' => :'Time'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::SandboxAccess` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::SandboxAccess`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'url')
75
+ self.url = attributes[:'url']
76
+ else
77
+ self.url = nil
78
+ end
79
+
80
+ if attributes.key?(:'token')
81
+ self.token = attributes[:'token']
82
+ else
83
+ self.token = nil
84
+ end
85
+
86
+ if attributes.key?(:'expires_at')
87
+ self.expires_at = attributes[:'expires_at']
88
+ else
89
+ self.expires_at = nil
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ if @url.nil?
99
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
100
+ end
101
+
102
+ if @token.nil?
103
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
104
+ end
105
+
106
+ if @expires_at.nil?
107
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @url.nil?
118
+ return false if @token.nil?
119
+ return false if @expires_at.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] url Value to be assigned
125
+ def url=(url)
126
+ if url.nil?
127
+ fail ArgumentError, 'url cannot be nil'
128
+ end
129
+
130
+ @url = url
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] token Value to be assigned
135
+ def token=(token)
136
+ if token.nil?
137
+ fail ArgumentError, 'token cannot be nil'
138
+ end
139
+
140
+ @token = token
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] expires_at Value to be assigned
145
+ def expires_at=(expires_at)
146
+ if expires_at.nil?
147
+ fail ArgumentError, 'expires_at cannot be nil'
148
+ end
149
+
150
+ @expires_at = expires_at
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ url == o.url &&
159
+ token == o.token &&
160
+ expires_at == o.expires_at
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [url, token, expires_at].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ end
215
+
216
+ end
@@ -0,0 +1,221 @@
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 SandboxAccessRequest < ApiModelBase
18
+ attr_accessor :port
19
+
20
+ attr_accessor :expires_in_seconds
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'port' => :'port',
26
+ :'expires_in_seconds' => :'expires_in_seconds'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'port' => :'Integer',
44
+ :'expires_in_seconds' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Volcano::Generated::SandboxAccessRequest` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Volcano::Generated::SandboxAccessRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'port')
71
+ self.port = attributes[:'port']
72
+ else
73
+ self.port = nil
74
+ end
75
+
76
+ if attributes.key?(:'expires_in_seconds')
77
+ self.expires_in_seconds = attributes[:'expires_in_seconds']
78
+ else
79
+ self.expires_in_seconds = 300
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ if @port.nil?
89
+ invalid_properties.push('invalid value for "port", port cannot be nil.')
90
+ end
91
+
92
+ if @port > 65532
93
+ invalid_properties.push('invalid value for "port", must be smaller than or equal to 65532.')
94
+ end
95
+
96
+ if @port < 1
97
+ invalid_properties.push('invalid value for "port", must be greater than or equal to 1.')
98
+ end
99
+
100
+ if !@expires_in_seconds.nil? && @expires_in_seconds > 300
101
+ invalid_properties.push('invalid value for "expires_in_seconds", must be smaller than or equal to 300.')
102
+ end
103
+
104
+ if !@expires_in_seconds.nil? && @expires_in_seconds < 1
105
+ invalid_properties.push('invalid value for "expires_in_seconds", must be greater than or equal to 1.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @port.nil?
116
+ return false if @port > 65532
117
+ return false if @port < 1
118
+ return false if !@expires_in_seconds.nil? && @expires_in_seconds > 300
119
+ return false if !@expires_in_seconds.nil? && @expires_in_seconds < 1
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] port Value to be assigned
125
+ def port=(port)
126
+ if port.nil?
127
+ fail ArgumentError, 'port cannot be nil'
128
+ end
129
+
130
+ if port > 65532
131
+ fail ArgumentError, 'invalid value for "port", must be smaller than or equal to 65532.'
132
+ end
133
+
134
+ if port < 1
135
+ fail ArgumentError, 'invalid value for "port", must be greater than or equal to 1.'
136
+ end
137
+
138
+ @port = port
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] expires_in_seconds Value to be assigned
143
+ def expires_in_seconds=(expires_in_seconds)
144
+ if expires_in_seconds.nil?
145
+ fail ArgumentError, 'expires_in_seconds cannot be nil'
146
+ end
147
+
148
+ if expires_in_seconds > 300
149
+ fail ArgumentError, 'invalid value for "expires_in_seconds", must be smaller than or equal to 300.'
150
+ end
151
+
152
+ if expires_in_seconds < 1
153
+ fail ArgumentError, 'invalid value for "expires_in_seconds", must be greater than or equal to 1.'
154
+ end
155
+
156
+ @expires_in_seconds = expires_in_seconds
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ port == o.port &&
165
+ expires_in_seconds == o.expires_in_seconds
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(o)
171
+ self == o
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Integer] Hash code
176
+ def hash
177
+ [port, expires_in_seconds].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def self.build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ attributes = attributes.transform_keys(&:to_sym)
186
+ transformed_hash = {}
187
+ openapi_types.each_pair do |key, type|
188
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = nil
190
+ elsif type =~ /\AArray<(.*)>/i
191
+ # check to ensure the input is an array given that the attribute
192
+ # is documented as an array but the input is not
193
+ if attributes[attribute_map[key]].is_a?(Array)
194
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
195
+ end
196
+ elsif !attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
198
+ end
199
+ end
200
+ new(transformed_hash)
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ end
220
+
221
+ end