# 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 # # Instance view status. # class InstanceViewStatus include MsRestAzure # @return [String] Gets or sets the status Code. attr_accessor :code # @return [StatusLevelTypes] Gets or sets the level Code. Possible # values for this property include: 'Info', 'Warning', 'Error'. attr_accessor :level # @return [String] Gets or sets the short localizable label for the # status. attr_accessor :display_status # @return [String] Gets or sets the optional detailed Message, including # for alerts and error messages. attr_accessor :message # @return [DateTime] Gets or sets the time of the status. attr_accessor :time # # Validate the object. Throws ValidationError if validation fails. # def validate 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.code output_object['code'] = serialized_property unless serialized_property.nil? serialized_property = object.level output_object['level'] = serialized_property unless serialized_property.nil? serialized_property = object.display_status output_object['displayStatus'] = serialized_property unless serialized_property.nil? serialized_property = object.message output_object['message'] = serialized_property unless serialized_property.nil? serialized_property = object.time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['time'] = 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 [InstanceViewStatus] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = InstanceViewStatus.new deserialized_property = object['code'] output_object.code = deserialized_property deserialized_property = object['level'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = StatusLevelTypes.constants.any? { |e| StatusLevelTypes.const_get(e).to_s.downcase == deserialized_property.downcase } fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid end output_object.level = deserialized_property deserialized_property = object['displayStatus'] output_object.display_status = deserialized_property deserialized_property = object['message'] output_object.message = deserialized_property deserialized_property = object['time'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.time = deserialized_property output_object.validate output_object end end end end