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