# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Compute module Models # # Describes a storage profile. # class StorageProfile include MsRestAzure # @return [ImageReference] Gets or sets the image reference. attr_accessor :image_reference # @return [OSDisk] Gets or sets the OS disk. attr_accessor :os_disk # @return [Array] Gets or sets the data disks. attr_accessor :data_disks # # Validate the object. Throws ValidationError if validation fails. # def validate @image_reference.validate unless @image_reference.nil? @os_disk.validate unless @os_disk.nil? @data_disks.each{ |e| e.validate if e.respond_to?(:validate) } unless @data_disks.nil? end # # Serializes given Model object into Ruby Hash. # @param object Model object to serialize. # @return [Hash] Serialized object in form of Ruby Hash. # def self.serialize_object(object) object.validate output_object = {} serialized_property = object.image_reference unless serialized_property.nil? serialized_property = ImageReference.serialize_object(serialized_property) end output_object['imageReference'] = serialized_property unless serialized_property.nil? serialized_property = object.os_disk unless serialized_property.nil? serialized_property = OSDisk.serialize_object(serialized_property) end output_object['osDisk'] = serialized_property unless serialized_property.nil? serialized_property = object.data_disks unless serialized_property.nil? serializedArray = [] serialized_property.each do |element| unless element.nil? element = DataDisk.serialize_object(element) end serializedArray.push(element) end serialized_property = serializedArray end output_object['dataDisks'] = serialized_property unless serialized_property.nil? output_object end # # Deserializes given Ruby Hash into Model object. # @param object [Hash] Ruby Hash object to deserialize. # @return [StorageProfile] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = StorageProfile.new deserialized_property = object['imageReference'] unless deserialized_property.nil? deserialized_property = ImageReference.deserialize_object(deserialized_property) end output_object.image_reference = deserialized_property deserialized_property = object['osDisk'] unless deserialized_property.nil? deserialized_property = OSDisk.deserialize_object(deserialized_property) end output_object.os_disk = deserialized_property deserialized_property = object['dataDisks'] unless deserialized_property.nil? deserializedArray = []; deserialized_property.each do |element1| unless element1.nil? element1 = DataDisk.deserialize_object(element1) end deserializedArray.push(element1); end deserialized_property = deserializedArray; end output_object.data_disks = deserialized_property output_object.validate output_object end end end end