# 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 # # Api error. # class ApiError include MsRestAzure # @return [Array] Gets or sets the Api error details attr_accessor :details # @return [InnerError] Gets or sets the Api inner error attr_accessor :innererror # @return [String] Gets or sets the error code. attr_accessor :code # @return [String] Gets or sets the target of the particular error. attr_accessor :target # @return [String] Gets or sets the error message. attr_accessor :message # # Validate the object. Throws ValidationError if validation fails. # def validate @details.each{ |e| e.validate if e.respond_to?(:validate) } unless @details.nil? @innererror.validate unless @innererror.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.details unless serialized_property.nil? serializedArray = [] serialized_property.each do |element| unless element.nil? element = ApiErrorBase.serialize_object(element) end serializedArray.push(element) end serialized_property = serializedArray end output_object['details'] = serialized_property unless serialized_property.nil? serialized_property = object.innererror unless serialized_property.nil? serialized_property = InnerError.serialize_object(serialized_property) end output_object['innererror'] = serialized_property unless serialized_property.nil? serialized_property = object.code output_object['code'] = serialized_property unless serialized_property.nil? serialized_property = object.target output_object['target'] = serialized_property unless serialized_property.nil? serialized_property = object.message output_object['message'] = 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 [ApiError] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = ApiError.new deserialized_property = object['details'] unless deserialized_property.nil? deserializedArray = []; deserialized_property.each do |element1| unless element1.nil? element1 = ApiErrorBase.deserialize_object(element1) end deserializedArray.push(element1); end deserialized_property = deserializedArray; end output_object.details = deserialized_property deserialized_property = object['innererror'] unless deserialized_property.nil? deserialized_property = InnerError.deserialize_object(deserialized_property) end output_object.innererror = deserialized_property deserialized_property = object['code'] output_object.code = deserialized_property deserialized_property = object['target'] output_object.target = deserialized_property deserialized_property = object['message'] output_object.message = deserialized_property output_object.validate output_object end end end end