Class: DaytonaApiClient::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/daytona_api_client/models/runner.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Runner

Initializes the object



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/daytona_api_client/models/runner.rb', line 200

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::Runner` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::Runner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'domain')
    self.domain = attributes[:'domain']
  else
    self.domain = nil
  end

  if attributes.key?(:'api_url')
    self.api_url = attributes[:'api_url']
  else
    self.api_url = nil
  end

  if attributes.key?(:'proxy_url')
    self.proxy_url = attributes[:'proxy_url']
  else
    self.proxy_url = nil
  end

  if attributes.key?(:'api_key')
    self.api_key = attributes[:'api_key']
  else
    self.api_key = nil
  end

  if attributes.key?(:'cpu')
    self.cpu = attributes[:'cpu']
  else
    self.cpu = nil
  end

  if attributes.key?(:'memory')
    self.memory = attributes[:'memory']
  else
    self.memory = nil
  end

  if attributes.key?(:'disk')
    self.disk = attributes[:'disk']
  else
    self.disk = nil
  end

  if attributes.key?(:'gpu')
    self.gpu = attributes[:'gpu']
  else
    self.gpu = nil
  end

  if attributes.key?(:'gpu_type')
    self.gpu_type = attributes[:'gpu_type']
  else
    self.gpu_type = nil
  end

  if attributes.key?(:'_class')
    self._class = attributes[:'_class']
  else
    self._class = nil
  end

  if attributes.key?(:'current_cpu_usage_percentage')
    self.current_cpu_usage_percentage = attributes[:'current_cpu_usage_percentage']
  end

  if attributes.key?(:'current_memory_usage_percentage')
    self.current_memory_usage_percentage = attributes[:'current_memory_usage_percentage']
  end

  if attributes.key?(:'current_disk_usage_percentage')
    self.current_disk_usage_percentage = attributes[:'current_disk_usage_percentage']
  end

  if attributes.key?(:'current_allocated_cpu')
    self.current_allocated_cpu = attributes[:'current_allocated_cpu']
  end

  if attributes.key?(:'current_allocated_memory_gi_b')
    self.current_allocated_memory_gi_b = attributes[:'current_allocated_memory_gi_b']
  end

  if attributes.key?(:'current_allocated_disk_gi_b')
    self.current_allocated_disk_gi_b = attributes[:'current_allocated_disk_gi_b']
  end

  if attributes.key?(:'current_snapshot_count')
    self.current_snapshot_count = attributes[:'current_snapshot_count']
  end

  if attributes.key?(:'availability_score')
    self.availability_score = attributes[:'availability_score']
  end

  if attributes.key?(:'region')
    self.region = attributes[:'region']
  else
    self.region = nil
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  else
    self.state = nil
  end

  if attributes.key?(:'last_checked')
    self.last_checked = attributes[:'last_checked']
  end

  if attributes.key?(:'unschedulable')
    self.unschedulable = attributes[:'unschedulable']
  else
    self.unschedulable = nil
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end

  if attributes.key?(:'version')
    self.version = attributes[:'version']
  else
    self.version = nil
  end
end

Instance Attribute Details

#_classObject

The class of the runner



49
50
51
# File 'lib/daytona_api_client/models/runner.rb', line 49

def _class
  @_class
end

#api_keyObject

The API key for the runner



31
32
33
# File 'lib/daytona_api_client/models/runner.rb', line 31

def api_key
  @api_key
end

#api_urlObject

The API URL of the runner



25
26
27
# File 'lib/daytona_api_client/models/runner.rb', line 25

def api_url
  @api_url
end

#availability_scoreObject

Runner availability score



73
74
75
# File 'lib/daytona_api_client/models/runner.rb', line 73

def availability_score
  @availability_score
end

#cpuObject

The CPU capacity of the runner



34
35
36
# File 'lib/daytona_api_client/models/runner.rb', line 34

def cpu
  @cpu
end

#created_atObject

The creation timestamp of the runner



88
89
90
# File 'lib/daytona_api_client/models/runner.rb', line 88

def created_at
  @created_at
end

#current_allocated_cpuObject

Current allocated CPU



61
62
63
# File 'lib/daytona_api_client/models/runner.rb', line 61

def current_allocated_cpu
  @current_allocated_cpu
end

#current_allocated_disk_gi_bObject

Current allocated disk in GiB



67
68
69
# File 'lib/daytona_api_client/models/runner.rb', line 67

def current_allocated_disk_gi_b
  @current_allocated_disk_gi_b
end

#current_allocated_memory_gi_bObject

Current allocated memory in GiB



64
65
66
# File 'lib/daytona_api_client/models/runner.rb', line 64

def current_allocated_memory_gi_b
  @current_allocated_memory_gi_b
end

#current_cpu_usage_percentageObject

Current CPU usage percentage



52
53
54
# File 'lib/daytona_api_client/models/runner.rb', line 52

def current_cpu_usage_percentage
  @current_cpu_usage_percentage
end

#current_disk_usage_percentageObject

Current disk usage percentage



58
59
60
# File 'lib/daytona_api_client/models/runner.rb', line 58

def current_disk_usage_percentage
  @current_disk_usage_percentage
end

#current_memory_usage_percentageObject

Current RAM usage percentage



55
56
57
# File 'lib/daytona_api_client/models/runner.rb', line 55

def current_memory_usage_percentage
  @current_memory_usage_percentage
end

#current_snapshot_countObject

Current snapshot count



70
71
72
# File 'lib/daytona_api_client/models/runner.rb', line 70

def current_snapshot_count
  @current_snapshot_count
end

#diskObject

The disk capacity of the runner in GiB



40
41
42
# File 'lib/daytona_api_client/models/runner.rb', line 40

def disk
  @disk
end

#domainObject

The domain of the runner



22
23
24
# File 'lib/daytona_api_client/models/runner.rb', line 22

def domain
  @domain
end

#gpuObject

The GPU capacity of the runner



43
44
45
# File 'lib/daytona_api_client/models/runner.rb', line 43

def gpu
  @gpu
end

#gpu_typeObject

The type of GPU



46
47
48
# File 'lib/daytona_api_client/models/runner.rb', line 46

def gpu_type
  @gpu_type
end

#idObject

The ID of the runner



19
20
21
# File 'lib/daytona_api_client/models/runner.rb', line 19

def id
  @id
end

#last_checkedObject

The last time the runner was checked



82
83
84
# File 'lib/daytona_api_client/models/runner.rb', line 82

def last_checked
  @last_checked
end

#memoryObject

The memory capacity of the runner in GiB



37
38
39
# File 'lib/daytona_api_client/models/runner.rb', line 37

def memory
  @memory
end

#proxy_urlObject

The proxy URL of the runner



28
29
30
# File 'lib/daytona_api_client/models/runner.rb', line 28

def proxy_url
  @proxy_url
end

#regionObject

The region of the runner



76
77
78
# File 'lib/daytona_api_client/models/runner.rb', line 76

def region
  @region
end

#stateObject

The state of the runner



79
80
81
# File 'lib/daytona_api_client/models/runner.rb', line 79

def state
  @state
end

#unschedulableObject

Whether the runner is unschedulable



85
86
87
# File 'lib/daytona_api_client/models/runner.rb', line 85

def unschedulable
  @unschedulable
end

#updated_atObject

The last update timestamp of the runner



91
92
93
# File 'lib/daytona_api_client/models/runner.rb', line 91

def updated_at
  @updated_at
end

#versionObject

The version of the runner



94
95
96
# File 'lib/daytona_api_client/models/runner.rb', line 94

def version
  @version
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type



695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/daytona_api_client/models/runner.rb', line 695

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = DaytonaApiClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



151
152
153
# File 'lib/daytona_api_client/models/runner.rb', line 151

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



156
157
158
# File 'lib/daytona_api_client/models/runner.rb', line 156

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/daytona_api_client/models/runner.rb', line 119

def self.attribute_map
  {
    :'id' => :'id',
    :'domain' => :'domain',
    :'api_url' => :'apiUrl',
    :'proxy_url' => :'proxyUrl',
    :'api_key' => :'apiKey',
    :'cpu' => :'cpu',
    :'memory' => :'memory',
    :'disk' => :'disk',
    :'gpu' => :'gpu',
    :'gpu_type' => :'gpuType',
    :'_class' => :'class',
    :'current_cpu_usage_percentage' => :'currentCpuUsagePercentage',
    :'current_memory_usage_percentage' => :'currentMemoryUsagePercentage',
    :'current_disk_usage_percentage' => :'currentDiskUsagePercentage',
    :'current_allocated_cpu' => :'currentAllocatedCpu',
    :'current_allocated_memory_gi_b' => :'currentAllocatedMemoryGiB',
    :'current_allocated_disk_gi_b' => :'currentAllocatedDiskGiB',
    :'current_snapshot_count' => :'currentSnapshotCount',
    :'availability_score' => :'availabilityScore',
    :'region' => :'region',
    :'state' => :'state',
    :'last_checked' => :'lastChecked',
    :'unschedulable' => :'unschedulable',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt',
    :'version' => :'version'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/daytona_api_client/models/runner.rb', line 671

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



193
194
195
196
# File 'lib/daytona_api_client/models/runner.rb', line 193

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/daytona_api_client/models/runner.rb', line 161

def self.openapi_types
  {
    :'id' => :'String',
    :'domain' => :'String',
    :'api_url' => :'String',
    :'proxy_url' => :'String',
    :'api_key' => :'String',
    :'cpu' => :'Float',
    :'memory' => :'Float',
    :'disk' => :'Float',
    :'gpu' => :'Float',
    :'gpu_type' => :'String',
    :'_class' => :'SandboxClass',
    :'current_cpu_usage_percentage' => :'Float',
    :'current_memory_usage_percentage' => :'Float',
    :'current_disk_usage_percentage' => :'Float',
    :'current_allocated_cpu' => :'Float',
    :'current_allocated_memory_gi_b' => :'Float',
    :'current_allocated_disk_gi_b' => :'Float',
    :'current_snapshot_count' => :'Float',
    :'availability_score' => :'Float',
    :'region' => :'String',
    :'state' => :'RunnerState',
    :'last_checked' => :'String',
    :'unschedulable' => :'Boolean',
    :'created_at' => :'String',
    :'updated_at' => :'String',
    :'version' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/daytona_api_client/models/runner.rb', line 625

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      domain == o.domain &&
      api_url == o.api_url &&
      proxy_url == o.proxy_url &&
      api_key == o.api_key &&
      cpu == o.cpu &&
      memory == o.memory &&
      disk == o.disk &&
      gpu == o.gpu &&
      gpu_type == o.gpu_type &&
      _class == o._class &&
      current_cpu_usage_percentage == o.current_cpu_usage_percentage &&
      current_memory_usage_percentage == o.current_memory_usage_percentage &&
      current_disk_usage_percentage == o.current_disk_usage_percentage &&
      current_allocated_cpu == o.current_allocated_cpu &&
      current_allocated_memory_gi_b == o.current_allocated_memory_gi_b &&
      current_allocated_disk_gi_b == o.current_allocated_disk_gi_b &&
      current_snapshot_count == o.current_snapshot_count &&
      availability_score == o.availability_score &&
      region == o.region &&
      state == o.state &&
      last_checked == o.last_checked &&
      unschedulable == o.unschedulable &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      version == o.version
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'lib/daytona_api_client/models/runner.rb', line 766

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


658
659
660
# File 'lib/daytona_api_client/models/runner.rb', line 658

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.



664
665
666
# File 'lib/daytona_api_client/models/runner.rb', line 664

def hash
  [id, domain, api_url, proxy_url, api_key, cpu, memory, disk, gpu, gpu_type, _class, current_cpu_usage_percentage, current_memory_usage_percentage, current_disk_usage_percentage, current_allocated_cpu, current_allocated_memory_gi_b, current_allocated_disk_gi_b, current_snapshot_count, availability_score, region, state, last_checked, unschedulable, created_at, updated_at, version].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/daytona_api_client/models/runner.rb', line 355

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @domain.nil?
    invalid_properties.push('invalid value for "domain", domain cannot be nil.')
  end

  if @api_url.nil?
    invalid_properties.push('invalid value for "api_url", api_url cannot be nil.')
  end

  if @proxy_url.nil?
    invalid_properties.push('invalid value for "proxy_url", proxy_url cannot be nil.')
  end

  if @api_key.nil?
    invalid_properties.push('invalid value for "api_key", api_key cannot be nil.')
  end

  if @cpu.nil?
    invalid_properties.push('invalid value for "cpu", cpu cannot be nil.')
  end

  if @memory.nil?
    invalid_properties.push('invalid value for "memory", memory cannot be nil.')
  end

  if @disk.nil?
    invalid_properties.push('invalid value for "disk", disk cannot be nil.')
  end

  if @gpu.nil?
    invalid_properties.push('invalid value for "gpu", gpu cannot be nil.')
  end

  if @gpu_type.nil?
    invalid_properties.push('invalid value for "gpu_type", gpu_type cannot be nil.')
  end

  if @_class.nil?
    invalid_properties.push('invalid value for "_class", _class cannot be nil.')
  end

  if @region.nil?
    invalid_properties.push('invalid value for "region", region cannot be nil.')
  end

  if @state.nil?
    invalid_properties.push('invalid value for "state", state cannot be nil.')
  end

  if @unschedulable.nil?
    invalid_properties.push('invalid value for "unschedulable", unschedulable cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  if @version.nil?
    invalid_properties.push('invalid value for "version", version cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



742
743
744
# File 'lib/daytona_api_client/models/runner.rb', line 742

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



748
749
750
751
752
753
754
755
756
757
758
759
760
# File 'lib/daytona_api_client/models/runner.rb', line 748

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object



736
737
738
# File 'lib/daytona_api_client/models/runner.rb', line 736

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/daytona_api_client/models/runner.rb', line 431

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @domain.nil?
  return false if @api_url.nil?
  return false if @proxy_url.nil?
  return false if @api_key.nil?
  return false if @cpu.nil?
  return false if @memory.nil?
  return false if @disk.nil?
  return false if @gpu.nil?
  return false if @gpu_type.nil?
  return false if @_class.nil?
  return false if @region.nil?
  return false if @state.nil?
  return false if @unschedulable.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  return false if @version.nil?
  true
end