Class: VSphereAutomation::Content::ContentLibraryItemModel

Inherits:
Object
  • Object
show all
Defined in:
lib/vsphere-automation-content/models/content_library_item_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ContentLibraryItemModel

Initializes the object

Parameters:

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

    Model attributes in the form of hash



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 98

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

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

  if attributes.has_key?(:'library_id')
    self.library_id = attributes[:'library_id']
  end

  if attributes.has_key?(:'content_version')
    self.content_version = attributes[:'content_version']
  end

  if attributes.has_key?(:'creation_time')
    self.creation_time = attributes[:'creation_time']
  end

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

  if attributes.has_key?(:'last_modified_time')
    self.last_modified_time = attributes[:'last_modified_time']
  end

  if attributes.has_key?(:'last_sync_time')
    self.last_sync_time = attributes[:'last_sync_time']
  end

  if attributes.has_key?(:'metadata_version')
    self. = attributes[:'metadata_version']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'cached')
    self.cached = attributes[:'cached']
  end

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

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

  if attributes.has_key?(:'version')
    self.version = attributes[:'version']
  end

  if attributes.has_key?(:'source_id')
    self.source_id = attributes[:'source_id']
  end
end

Instance Attribute Details

#cachedObject

The status that indicates whether the library item is on disk or not. The library item is cached when all its files are on disk.



42
43
44
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 42

def cached
  @cached
end

#content_versionObject

The version of the file content list of this library item.



21
22
23
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 21

def content_version
  @content_version
end

#creation_timeObject

The date and time when this library item was created.



24
25
26
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 24

def creation_time
  @creation_time
end

#descriptionObject

A human-readable description for this library item.



27
28
29
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 27

def description
  @description
end

#idObject

A unique identifier for this library item.



15
16
17
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 15

def id
  @id
end

#last_modified_timeObject

The date and time when the metadata for this library item was last changed. <p> This field is affected by changes to the properties or file content of this item. It is not modified by changes to the tags of the item, or by changes to the library which owns this item.



30
31
32
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 30

def last_modified_time
  @last_modified_time
end

#last_sync_timeObject

The date and time when this library item was last synchronized. <p> This field is updated every time a synchronization is triggered on the library item, including when a synchronization is triggered on the library to which this item belongs. The value is unset for a library item that belongs to a local library.



33
34
35
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 33

def last_sync_time
  @last_sync_time
end

#library_idObject

The identifier of the LibraryModel to which this item belongs.



18
19
20
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 18

def library_id
  @library_id
end

#metadata_versionObject

A version number for the metadata of this library item. <p> This value is incremented with each change to the metadata of this item. Changes to name, description, and so on will increment this value. The value is not incremented by changes to the content or tags of the item or the library which owns it.



36
37
38
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 36

def 
  @metadata_version
end

#nameObject

A human-readable name for this library item. <p> The name may not be unset or an empty string. The name does not have to be unique, even within the same library.



39
40
41
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 39

def name
  @name
end

#sizeObject

The library item size, in bytes. The size is the sum of the size used on the storage backing for all the files in the item. When the library item is not cached, the size is 0.



45
46
47
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 45

def size
  @size
end

#source_idObject

The identifier of the ItemModel to which this item is synchronized to if the item belongs to a subscribed library. The value is unset for a library item that belongs to a local library.



54
55
56
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 54

def source_id
  @source_id
end

#typeObject

An optional type identifier which indicates the type adapter plugin to use. <p> This field may be set to a non-empty string value that corresponds to an identifier supported by a type adapter plugin present in the Content Library Service. A type adapter plugin, if present for the specified type, can provide additional information and services around the item content. A type adapter can guide the upload process by creating file entries that are in need of being uploaded to complete an item. <p> The types and plugins supported by the Content Library Service can be queried using the Type service.



48
49
50
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 48

def type
  @type
end

#versionObject

A version number that is updated on metadata changes. This value is used to validate update requests to provide optimistic concurrency of changes. <p> This value represents a number that is incremented every time library item properties, such as name or description, are changed. It is not incremented by changes to the file content of the library item, including adding or removing files. It is also not affected by tagging the library item.



51
52
53
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 51

def version
  @version
end

Class Method Details

.attribute_mapObject

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



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 57

def self.attribute_map
  {
    :'id' => :'id',
    :'library_id' => :'library_id',
    :'content_version' => :'content_version',
    :'creation_time' => :'creation_time',
    :'description' => :'description',
    :'last_modified_time' => :'last_modified_time',
    :'last_sync_time' => :'last_sync_time',
    :'metadata_version' => :'metadata_version',
    :'name' => :'name',
    :'cached' => :'cached',
    :'size' => :'size',
    :'type' => :'type',
    :'version' => :'version',
    :'source_id' => :'source_id'
  }
end

.openapi_typesObject

Attribute type mapping.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 77

def self.openapi_types
  {
    :'id' => :'String',
    :'library_id' => :'String',
    :'content_version' => :'String',
    :'creation_time' => :'DateTime',
    :'description' => :'String',
    :'last_modified_time' => :'DateTime',
    :'last_sync_time' => :'DateTime',
    :'metadata_version' => :'String',
    :'name' => :'String',
    :'cached' => :'Boolean',
    :'size' => :'Integer',
    :'type' => :'String',
    :'version' => :'String',
    :'source_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 176

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      library_id == o.library_id &&
      content_version == o.content_version &&
      creation_time == o.creation_time &&
      description == o.description &&
      last_modified_time == o.last_modified_time &&
      last_sync_time == o.last_sync_time &&
       == o. &&
      name == o.name &&
      cached == o.cached &&
      size == o.size &&
      type == o.type &&
      version == o.version &&
      source_id == o.source_id
end

#_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



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
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 231

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN, :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
    temp_model = VSphereAutomation::Content.const_get(type).new
    temp_model.build_from_hash(value)
  end
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



297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 297

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

#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



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 210

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


197
198
199
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 197

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



203
204
205
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 203

def hash
  [id, library_id, content_version, creation_time, description, last_modified_time, last_sync_time, , name, cached, size, type, version, source_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



163
164
165
166
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 163

def list_invalid_properties
  invalid_properties = Array.new
  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



277
278
279
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 277

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



283
284
285
286
287
288
289
290
291
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 283

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



271
272
273
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 271

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



170
171
172
# File 'lib/vsphere-automation-content/models/content_library_item_model.rb', line 170

def valid?
  true
end