Class: LinodeOpenapiClient::PostUploadImage200ResponseImage

Inherits:
Object
  • Object
show all
Defined in:
lib/linode_openapi_client/models/post_upload_image200_response_image.rb

Overview

Image object.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PostUploadImage200ResponseImage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



160
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
191
192
193
194
195
196
197
198
199
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
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 160

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

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

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

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

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

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

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

  if attributes.key?(:'regions')
    if (value = attributes[:'regions']).is_a?(Array)
      self.regions = value
    end
  end

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

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

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

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

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

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

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

  if attributes.key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Array)
      self.tags = value
    end
  end

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

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

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

  if attributes.key?(:'capabilities')
    if (value = attributes[:'capabilities']).is_a?(Array)
      self.capabilities = value
    end
  end
end

Instance Attribute Details

#capabilitiesObject

Read-only A list of the possible capabilities of this image. - ‘cloud-init`. The image supports the cloud-init multi-distribution method with our [Metadata service](www.linode.com/docs/products/compute/compute-instances/guides/metadata/#troubleshoot-metadata-and-cloud-init). This only applies to public images. - `distributed-sites`. Whether the image can be used in distributed compute regions. Compared to a core compute region, distributed compute regions offer limited functionality, but they’re globally distributed. Your image can be geographically closer to you, potentially letting you deploy it quicker.



71
72
73
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 71

def capabilities
  @capabilities
end

#createdObject

Read-only When this image was created.



50
51
52
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 50

def created
  @created
end

#created_byObject

Read-only The name of the user who created this image, or ‘linode` for public images.



47
48
49
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 47

def created_by
  @created_by
end

#deprecatedObject

__Filterable__, Read-only Whether this image is deprecated. Only public images can be deprecated.



56
57
58
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 56

def deprecated
  @deprecated
end

#descriptionObject

A detailed description of this image.



32
33
34
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 32

def description
  @description
end

#eolObject

Read-only The date of the public image’s planned removal from service. This is ‘null` for private images.



29
30
31
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 29

def eol
  @eol
end

#expiryObject

Read-only Only images created automatically from a deleted compute instance (type=automatic) expire. This is ‘null` for private images.



20
21
22
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 20

def expiry
  @expiry
end

#idObject

Read-only The unique identifier for each image.



62
63
64
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 62

def id
  @id
end

#is_publicObject

__Filterable__, Read-only Revealed as ‘true` if the image is a public distribution image. Private, account-specific images are listed as `false`.



53
54
55
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 53

def is_public
  @is_public
end

#labelObject

__Filterable__ A short description of the image.



38
39
40
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 38

def label
  @label
end

#regionsObject

Read-only Details on the regions where this image is stored. > 📘 > > This array is empty for existing images. It’s intended for use with future functionality.



35
36
37
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 35

def regions
  @regions
end

#sizeObject

__Filterable__, Read-only The minimum size in MB this image needs to deploy.



44
45
46
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 44

def size
  @size
end

#statusObject

__Filterable__, Read-only The current status of the image. Possible values are ‘available`, `creating`, and `pending_upload`. > 📘 > > The `+order_by` and `+order` operators are not available when [filtering](techdocs.akamai.com/linode-api/reference/filtering-and-sorting) on this key.



68
69
70
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 68

def status
  @status
end

#tagsObject

__Filterable__ Tags used for organizational purposes. A tag can be from 3 to 100 characters long, and an image can have a maximum of 500 total tags.



59
60
61
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 59

def tags
  @tags
end

#total_sizeObject

Read-only The total size in bytes of all instances of this image, in all ‘regions`. > 📘 > > This object is empty for existing images. It’s intended for use with future functionality.



65
66
67
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 65

def total_size
  @total_size
end

#typeObject

__Filterable__, Read-only How the image was created. Create a ‘manual` image at any time. An `automatic` image is created automatically from a deleted compute instance.



41
42
43
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 41

def type
  @type
end

#updatedObject

Read-only When this image was last updated.



23
24
25
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 23

def updated
  @updated
end

#vendorObject

__Filterable__, Read-only The upstream distribution vendor. This is ‘null` for private images.



26
27
28
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 26

def vendor
  @vendor
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 407

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 = LinodeOpenapiClient.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_attributesObject

Returns all the JSON keys this model knows about



120
121
122
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 120

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 96

def self.attribute_map
  {
    :'expiry' => :'expiry',
    :'updated' => :'updated',
    :'vendor' => :'vendor',
    :'eol' => :'eol',
    :'description' => :'description',
    :'regions' => :'regions',
    :'label' => :'label',
    :'type' => :'type',
    :'size' => :'size',
    :'created_by' => :'created_by',
    :'created' => :'created',
    :'is_public' => :'is_public',
    :'deprecated' => :'deprecated',
    :'tags' => :'tags',
    :'id' => :'id',
    :'total_size' => :'total_size',
    :'status' => :'status',
    :'capabilities' => :'capabilities'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 383

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



149
150
151
152
153
154
155
156
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 149

def self.openapi_nullable
  Set.new([
    :'expiry',
    :'vendor',
    :'eol',
    :'description',
  ])
end

.openapi_typesObject

Attribute type mapping.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 125

def self.openapi_types
  {
    :'expiry' => :'Time',
    :'updated' => :'Time',
    :'vendor' => :'String',
    :'eol' => :'Time',
    :'description' => :'String',
    :'regions' => :'Array<PostUploadImage200ResponseImageRegionsInner>',
    :'label' => :'String',
    :'type' => :'String',
    :'size' => :'Integer',
    :'created_by' => :'String',
    :'created' => :'Time',
    :'is_public' => :'Boolean',
    :'deprecated' => :'Boolean',
    :'tags' => :'Array<String>',
    :'id' => :'String',
    :'total_size' => :'Integer',
    :'status' => :'String',
    :'capabilities' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 345

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      expiry == o.expiry &&
      updated == o.updated &&
      vendor == o.vendor &&
      eol == o.eol &&
      description == o.description &&
      regions == o.regions &&
      label == o.label &&
      type == o.type &&
      size == o.size &&
      created_by == o.created_by &&
      created == o.created &&
      is_public == o.is_public &&
      deprecated == o.deprecated &&
      tags == o.tags &&
      id == o.id &&
      total_size == o.total_size &&
      status == o.status &&
      capabilities == o.capabilities
end

#_to_hash(value) ⇒ Hash

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 478

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


370
371
372
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 370

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



376
377
378
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 376

def hash
  [expiry, updated, vendor, eol, description, regions, label, type, size, created_by, created, is_public, deprecated, tags, id, total_size, status, capabilities].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 254

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@description.nil? && @description.to_s.length > 65000
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 65000.')
  end

  if !@description.nil? && @description.to_s.length < 1
    invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
  end

  if !@tags.nil? && @tags.length > 500
    invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 500.')
  end

  if !@tags.nil? && @tags.length < 0
    invalid_properties.push('invalid value for "tags", number of items must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



454
455
456
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 454

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 460

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

Returns:

  • (String)

    String presentation of the object



448
449
450
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 448

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/linode_openapi_client/models/post_upload_image200_response_image.rb', line 278

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@description.nil? && @description.to_s.length > 65000
  return false if !@description.nil? && @description.to_s.length < 1
  type_validator = EnumAttributeValidator.new('String', ["manual", "automatic"])
  return false unless type_validator.valid?(@type)
  return false if !@tags.nil? && @tags.length > 500
  return false if !@tags.nil? && @tags.length < 0
  status_validator = EnumAttributeValidator.new('String', ["creating", "pending_upload", "available"])
  return false unless status_validator.valid?(@status)
  true
end