# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Compute module Models # # The compute long running operation response. # class DeleteOperationResult include MsRestAzure # @return [String] Gets the operation identifier. attr_accessor :operation_id # @return [OperationStatus] Gets the operation status. Possible values # include: 'InProgress', 'Succeeded', 'Failed' attr_accessor :status # @return [DateTime] Gets the operation start time attr_accessor :start_time # @return [DateTime] Gets the operation end time attr_accessor :end_time # @return [ApiError] Gets or sets the operation error if any occurred attr_accessor :error # # Validate the object. Throws ValidationError if validation fails. # def validate fail MsRest::ValidationError, 'property operation_id is nil' if @operation_id.nil? fail MsRest::ValidationError, 'property status is nil' if @status.nil? fail MsRest::ValidationError, 'property start_time is nil' if @start_time.nil? @error.validate unless @error.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.operation_id output_object['operationId'] = serialized_property unless serialized_property.nil? serialized_property = object.status output_object['status'] = serialized_property unless serialized_property.nil? serialized_property = object.start_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['startTime'] = serialized_property unless serialized_property.nil? serialized_property = object.end_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['endTime'] = serialized_property unless serialized_property.nil? serialized_property = object.error unless serialized_property.nil? serialized_property = ApiError.serialize_object(serialized_property) end output_object['error'] = 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 [DeleteOperationResult] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = DeleteOperationResult.new deserialized_property = object['operationId'] output_object.operation_id = deserialized_property deserialized_property = object['status'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = OperationStatus.constants.any? { |e| OperationStatus.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum OperationStatus does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.status = deserialized_property deserialized_property = object['startTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.start_time = deserialized_property deserialized_property = object['endTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.end_time = deserialized_property deserialized_property = object['error'] unless deserialized_property.nil? deserialized_property = ApiError.deserialize_object(deserialized_property) end output_object.error = deserialized_property output_object end end end end