Class: LinodeOpenapiClient::PutImageRequest
- Inherits:
-
Object
- Object
- LinodeOpenapiClient::PutImageRequest
- Defined in:
- lib/linode_openapi_client/models/put_image_request.rb
Overview
Image object.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
Read-only A list of the possible capabilities of this image.
-
#created ⇒ Object
Read-only When this image was created.
-
#created_by ⇒ Object
Read-only The name of the user who created this image, or ‘linode` for public images.
-
#deprecated ⇒ Object
__Filterable__, Read-only Whether this image is deprecated.
-
#description ⇒ Object
A detailed description of this image.
-
#eol ⇒ Object
Read-only The date of the public image’s planned removal from service.
-
#expiry ⇒ Object
Read-only Only images created automatically from a deleted compute instance (type=automatic) expire.
-
#id ⇒ Object
Read-only The unique identifier for each image.
-
#is_public ⇒ Object
__Filterable__, Read-only Revealed as ‘true` if the image is a public distribution image.
-
#label ⇒ Object
__Filterable__ A short description of the image.
-
#regions ⇒ Object
Read-only Details on the regions where this image is stored.
-
#size ⇒ Object
__Filterable__, Read-only The minimum size in MB this image needs to deploy.
-
#status ⇒ Object
__Filterable__, Read-only The current status of the image.
-
#tags ⇒ Object
__Filterable__ Tags used for organizational purposes.
-
#total_size ⇒ Object
Read-only The total size in bytes of all instances of this image, in all ‘regions`.
-
#type ⇒ Object
__Filterable__, Read-only How the image was created.
-
#updated ⇒ Object
Read-only When this image was last updated.
-
#vendor ⇒ Object
__Filterable__, Read-only The upstream distribution vendor.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PutImageRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ PutImageRequest
Initializes the object
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/put_image_request.rb', line 160 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `LinodeOpenapiClient::PutImageRequest` 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::PutImageRequest`. 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?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'label') self.label = attributes[:'label'] end if attributes.key?(:'regions') if (value = attributes[:'regions']).is_a?(Array) self.regions = value end end if attributes.key?(:'description') self.description = attributes[:'description'] 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?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self. = 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?(:'size') self.size = attributes[:'size'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'created_by') self.created_by = attributes[:'created_by'] end if attributes.key?(:'deprecated') self.deprecated = attributes[:'deprecated'] end if attributes.key?(:'is_public') self.is_public = attributes[:'is_public'] end if attributes.key?(:'capabilities') if (value = attributes[:'capabilities']).is_a?(Array) self.capabilities = value end end if attributes.key?(:'status') self.status = attributes[:'status'] end end |
Instance Attribute Details
#capabilities ⇒ Object
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.
68 69 70 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 68 def capabilities @capabilities end |
#created ⇒ Object
Read-only When this image was created.
56 57 58 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 56 def created @created end |
#created_by ⇒ Object
Read-only The name of the user who created this image, or ‘linode` for public images.
59 60 61 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 59 def created_by @created_by end |
#deprecated ⇒ Object
__Filterable__, Read-only Whether this image is deprecated. Only public images can be deprecated.
62 63 64 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 62 def deprecated @deprecated end |
#description ⇒ Object
A detailed description of this image.
32 33 34 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 32 def description @description end |
#eol ⇒ Object
Read-only The date of the public image’s planned removal from service. This is ‘null` for private images.
41 42 43 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 41 def eol @eol end |
#expiry ⇒ Object
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/put_image_request.rb', line 20 def expiry @expiry end |
#id ⇒ Object
Read-only The unique identifier for each image.
47 48 49 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 47 def id @id end |
#is_public ⇒ Object
__Filterable__, Read-only Revealed as ‘true` if the image is a public distribution image. Private, account-specific images are listed as `false`.
65 66 67 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 65 def is_public @is_public end |
#label ⇒ Object
__Filterable__ A short description of the image.
26 27 28 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 26 def label @label end |
#regions ⇒ Object
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.
29 30 31 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 29 def regions @regions end |
#size ⇒ Object
__Filterable__, Read-only The minimum size in MB this image needs to deploy.
53 54 55 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 53 def size @size end |
#status ⇒ Object
__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.
71 72 73 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 71 def status @status end |
#tags ⇒ Object
__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.
44 45 46 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 44 def @tags end |
#total_size ⇒ Object
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.
50 51 52 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 50 def total_size @total_size end |
#type ⇒ Object
__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.
23 24 25 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 23 def type @type end |
#updated ⇒ Object
Read-only When this image was last updated.
35 36 37 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 35 def updated @updated end |
#vendor ⇒ Object
__Filterable__, Read-only The upstream distribution vendor. This is ‘null` for private images.
38 39 40 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 38 def vendor @vendor end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
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/put_image_request.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_attributes ⇒ Object
Returns all the JSON keys this model knows about
120 121 122 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 120 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
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/put_image_request.rb', line 96 def self.attribute_map { :'expiry' => :'expiry', :'type' => :'type', :'label' => :'label', :'regions' => :'regions', :'description' => :'description', :'updated' => :'updated', :'vendor' => :'vendor', :'eol' => :'eol', :'tags' => :'tags', :'id' => :'id', :'total_size' => :'total_size', :'size' => :'size', :'created' => :'created', :'created_by' => :'created_by', :'deprecated' => :'deprecated', :'is_public' => :'is_public', :'capabilities' => :'capabilities', :'status' => :'status' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
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/put_image_request.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_nullable ⇒ Object
List of attributes with nullable: true
149 150 151 152 153 154 155 156 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 149 def self.openapi_nullable Set.new([ :'expiry', :'description', :'vendor', :'eol', ]) end |
.openapi_types ⇒ Object
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/put_image_request.rb', line 125 def self.openapi_types { :'expiry' => :'Time', :'type' => :'String', :'label' => :'String', :'regions' => :'Array<PostUploadImage200ResponseImageRegionsInner>', :'description' => :'String', :'updated' => :'Time', :'vendor' => :'String', :'eol' => :'Time', :'tags' => :'Array<String>', :'id' => :'String', :'total_size' => :'Integer', :'size' => :'Integer', :'created' => :'Time', :'created_by' => :'String', :'deprecated' => :'Boolean', :'is_public' => :'Boolean', :'capabilities' => :'Array<String>', :'status' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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/put_image_request.rb', line 345 def ==(o) return true if self.equal?(o) self.class == o.class && expiry == o.expiry && type == o.type && label == o.label && regions == o.regions && description == o.description && updated == o.updated && vendor == o.vendor && eol == o.eol && == o. && id == o.id && total_size == o.total_size && size == o.size && created == o.created && created_by == o.created_by && deprecated == o.deprecated && is_public == o.is_public && capabilities == o.capabilities && status == o.status end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
478 479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/linode_openapi_client/models/put_image_request.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
370 371 372 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 370 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
376 377 378 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 376 def hash [expiry, type, label, regions, description, updated, vendor, eol, , id, total_size, size, created, created_by, deprecated, is_public, capabilities, status].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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/put_image_request.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_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
454 455 456 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 454 def to_body to_hash end |
#to_hash ⇒ 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/put_image_request.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_s ⇒ String
Returns the string representation of the object
448 449 450 |
# File 'lib/linode_openapi_client/models/put_image_request.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
278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/linode_openapi_client/models/put_image_request.rb', line 278 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' type_validator = EnumAttributeValidator.new('String', ["manual", "automatic"]) return false unless type_validator.valid?(@type) return false if !@description.nil? && @description.to_s.length > 65000 return false if !@description.nil? && @description.to_s.length < 1 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 |